You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Dr. Jan Frederik Maas" <ja...@sub.uni-hamburg.de> on 2016/04/26 17:46:19 UTC

MoreLikeThis Component - how to get fields of documents

Hello,

I want to use the moreLikeThis Component to get similar documents from a 
sharded SOLR. This works quite well except for the fact that the 
documents in the moreLikeThis-list only contain the id/unique key of the 
documents.

Is it possible to get the other fields? I can of course do another query 
for the given IDs, but this would be complicated and very slow.

For example:

http://mysolrsystem/?q=id:524507260&mlt=true&mlt.fl=title&mlt.mintf=0&indent=true&mlt.match.include=true&fl=title,id,topic

creates

(...)
<lst name="moreLikeThis">
<result name="524507260" numFound="5" start="0" maxScore="4.583166">
<doc><str name="id">646199803</str></doc>
<doc><str name="id">613210832</str></doc>
<doc><str name="id">562239472</str></doc>
<doc><str name="id">819200034</str></doc>
<doc><str name="id">539877271</str></doc>
</result>
(...)

I tried to modify the fl-parameter, but I can only switch the ID-field 
in the moreLikeThis-Documents on and off (the latter resulting in empty 
document tags). In the result list however, the fl-fields are shown as 
specified.

I would be very grateful for help.

Best wishes,
Jan Maas

Re: Re: Re: MoreLikeThis Component - how to get fields of documents

Posted by "Dr. Jan Frederik Maas" <ja...@sub.uni-hamburg.de>.
Hey Alessandro,

it seems that the edismax MLThandler is not able to work correctly with 
a solr cloud/sharding:

https://issues.apache.org/jira/browse/SOLR-4414

Using the MLThandler we got randomly a response for only very few 
requests, while the MLTcomponent works fine (except for the problem I 
encountered...)

Best wishes,
Jan


Am 09.05.2016 um 12:01 schrieb Alessandro Benedetti:
> Hey Jan, any reason you are using the MLTComponent, instead of a specific
> Request Handler with the MLT query parser ?
>
> <requestHandler name="/getSimilar" class="solr.SearchHandler">
>      <lst name="defaults">
>          <!-- Query settings -->
>          <str name="title">Entities Similarity</str>
>          <str name="defType">edismax</str>
>          <str name="rows">5</str>
>          <str name="fl">*,score</str>
>          <str name="echoParams">explicit</str>
>          <str name="wt">json</str>
>          <str name="q">{!mlt qf=field1,field2,field3,field4 mintf=1
> mindf=5 maxqt=50 v=$entity_id}</str>
>          <!-- Default Similarity Parameters-->
>          <str name="entity_id">0</str>
>      </lst>
> </requestHandler>
>
>
> This should solve easily your problems,
>
> Cheers
>
>
> On Mon, May 9, 2016 at 9:58 AM, Dr. Jan Frederik Maas <
> jan.maas@sub.uni-hamburg.de> wrote:
>
>> Hi Edwin,
>>
>> thanks for your reply - we currently use 5.0.0
>>
>> Best wishes,
>> Jan
>>
>>
>> Am 05.05.2016 um 05:26 schrieb Zheng Lin Edwin Yeo:
>>
>>> Hi Jan,
>>>
>>> Which version of Solr are you using?
>>>
>>> Regards,
>>> Edwin
>>>
>>>
>>> On 26 April 2016 at 23:46, Dr. Jan Frederik Maas <
>>> jan.maas@sub.uni-hamburg.de> wrote:
>>>
>>> Hello,
>>>> I want to use the moreLikeThis Component to get similar documents from a
>>>> sharded SOLR. This works quite well except for the fact that the
>>>> documents
>>>> in the moreLikeThis-list only contain the id/unique key of the documents.
>>>>
>>>> Is it possible to get the other fields? I can of course do another query
>>>> for the given IDs, but this would be complicated and very slow.
>>>>
>>>> For example:
>>>>
>>>>
>>>>
>>>> http://mysolrsystem/?q=id:524507260&mlt=true&mlt.fl=title&mlt.mintf=0&indent=true&mlt.match.include=true&fl=title,id,topic
>>>>
>>>> creates
>>>>
>>>> (...)
>>>> <lst name="moreLikeThis">
>>>> <result name="524507260" numFound="5" start="0" maxScore="4.583166">
>>>> <doc><str name="id">646199803</str></doc>
>>>> <doc><str name="id">613210832</str></doc>
>>>> <doc><str name="id">562239472</str></doc>
>>>> <doc><str name="id">819200034</str></doc>
>>>> <doc><str name="id">539877271</str></doc>
>>>> </result>
>>>> (...)
>>>>
>>>> I tried to modify the fl-parameter, but I can only switch the ID-field in
>>>> the moreLikeThis-Documents on and off (the latter resulting in empty
>>>> document tags). In the result list however, the fl-fields are shown as
>>>> specified.
>>>>
>>>> I would be very grateful for help.
>>>>
>>>> Best wishes,
>>>> Jan Maas
>>>>
>>>>
>> --
>> Dr.-Ing. Jan Frederik Maas
>> Staats- und Universitaetsbibliothek Hamburg Carl von Ossietzky
>> IuK-Technik / Digitale Bibliothek / Entwicklung
>> Fachreferent f�r Informatik, Technik
>> Von-Melle-Park 3, 20146 Hamburg
>> Telefon (040) 42838-6674 | Fax (040) 41345070
>> Mail: maas@sub.uni-hamburg.de
>> http://www.sub.uni-hamburg.de
>>
>>
>


-- 
Dr.-Ing. Jan Frederik Maas
Staats- und Universitaetsbibliothek Hamburg Carl von Ossietzky
IuK-Technik / Digitale Bibliothek / Entwicklung
Fachreferent f�r Informatik, Technik
Von-Melle-Park 3, 20146 Hamburg
Telefon (040) 42838-6674 | Fax (040) 41345070
Mail: maas@sub.uni-hamburg.de
http://www.sub.uni-hamburg.de


Re: Re: MoreLikeThis Component - how to get fields of documents

Posted by Alessandro Benedetti <ab...@apache.org>.
Hey Jan, any reason you are using the MLTComponent, instead of a specific
Request Handler with the MLT query parser ?

<requestHandler name="/getSimilar" class="solr.SearchHandler">
    <lst name="defaults">
        <!-- Query settings -->
        <str name="title">Entities Similarity</str>
        <str name="defType">edismax</str>
        <str name="rows">5</str>
        <str name="fl">*,score</str>
        <str name="echoParams">explicit</str>
        <str name="wt">json</str>
        <str name="q">{!mlt qf=field1,field2,field3,field4 mintf=1
mindf=5 maxqt=50 v=$entity_id}</str>
        <!-- Default Similarity Parameters-->
        <str name="entity_id">0</str>
    </lst>
</requestHandler>


This should solve easily your problems,

Cheers


On Mon, May 9, 2016 at 9:58 AM, Dr. Jan Frederik Maas <
jan.maas@sub.uni-hamburg.de> wrote:

> Hi Edwin,
>
> thanks for your reply - we currently use 5.0.0
>
> Best wishes,
> Jan
>
>
> Am 05.05.2016 um 05:26 schrieb Zheng Lin Edwin Yeo:
>
>> Hi Jan,
>>
>> Which version of Solr are you using?
>>
>> Regards,
>> Edwin
>>
>>
>> On 26 April 2016 at 23:46, Dr. Jan Frederik Maas <
>> jan.maas@sub.uni-hamburg.de> wrote:
>>
>> Hello,
>>>
>>> I want to use the moreLikeThis Component to get similar documents from a
>>> sharded SOLR. This works quite well except for the fact that the
>>> documents
>>> in the moreLikeThis-list only contain the id/unique key of the documents.
>>>
>>> Is it possible to get the other fields? I can of course do another query
>>> for the given IDs, but this would be complicated and very slow.
>>>
>>> For example:
>>>
>>>
>>>
>>> http://mysolrsystem/?q=id:524507260&mlt=true&mlt.fl=title&mlt.mintf=0&indent=true&mlt.match.include=true&fl=title,id,topic
>>>
>>> creates
>>>
>>> (...)
>>> <lst name="moreLikeThis">
>>> <result name="524507260" numFound="5" start="0" maxScore="4.583166">
>>> <doc><str name="id">646199803</str></doc>
>>> <doc><str name="id">613210832</str></doc>
>>> <doc><str name="id">562239472</str></doc>
>>> <doc><str name="id">819200034</str></doc>
>>> <doc><str name="id">539877271</str></doc>
>>> </result>
>>> (...)
>>>
>>> I tried to modify the fl-parameter, but I can only switch the ID-field in
>>> the moreLikeThis-Documents on and off (the latter resulting in empty
>>> document tags). In the result list however, the fl-fields are shown as
>>> specified.
>>>
>>> I would be very grateful for help.
>>>
>>> Best wishes,
>>> Jan Maas
>>>
>>>
>
> --
> Dr.-Ing. Jan Frederik Maas
> Staats- und Universitaetsbibliothek Hamburg Carl von Ossietzky
> IuK-Technik / Digitale Bibliothek / Entwicklung
> Fachreferent für Informatik, Technik
> Von-Melle-Park 3, 20146 Hamburg
> Telefon (040) 42838-6674 | Fax (040) 41345070
> Mail: maas@sub.uni-hamburg.de
> http://www.sub.uni-hamburg.de
>
>


-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Re: MoreLikeThis Component - how to get fields of documents

Posted by "Dr. Jan Frederik Maas" <ja...@sub.uni-hamburg.de>.
Hi Edwin,

thanks for your reply - we currently use 5.0.0

Best wishes,
Jan

Am 05.05.2016 um 05:26 schrieb Zheng Lin Edwin Yeo:
> Hi Jan,
>
> Which version of Solr are you using?
>
> Regards,
> Edwin
>
>
> On 26 April 2016 at 23:46, Dr. Jan Frederik Maas <
> jan.maas@sub.uni-hamburg.de> wrote:
>
>> Hello,
>>
>> I want to use the moreLikeThis Component to get similar documents from a
>> sharded SOLR. This works quite well except for the fact that the documents
>> in the moreLikeThis-list only contain the id/unique key of the documents.
>>
>> Is it possible to get the other fields? I can of course do another query
>> for the given IDs, but this would be complicated and very slow.
>>
>> For example:
>>
>>
>> http://mysolrsystem/?q=id:524507260&mlt=true&mlt.fl=title&mlt.mintf=0&indent=true&mlt.match.include=true&fl=title,id,topic
>>
>> creates
>>
>> (...)
>> <lst name="moreLikeThis">
>> <result name="524507260" numFound="5" start="0" maxScore="4.583166">
>> <doc><str name="id">646199803</str></doc>
>> <doc><str name="id">613210832</str></doc>
>> <doc><str name="id">562239472</str></doc>
>> <doc><str name="id">819200034</str></doc>
>> <doc><str name="id">539877271</str></doc>
>> </result>
>> (...)
>>
>> I tried to modify the fl-parameter, but I can only switch the ID-field in
>> the moreLikeThis-Documents on and off (the latter resulting in empty
>> document tags). In the result list however, the fl-fields are shown as
>> specified.
>>
>> I would be very grateful for help.
>>
>> Best wishes,
>> Jan Maas
>>


-- 
Dr.-Ing. Jan Frederik Maas
Staats- und Universitaetsbibliothek Hamburg Carl von Ossietzky
IuK-Technik / Digitale Bibliothek / Entwicklung
Fachreferent f�r Informatik, Technik
Von-Melle-Park 3, 20146 Hamburg
Telefon (040) 42838-6674 | Fax (040) 41345070
Mail: maas@sub.uni-hamburg.de
http://www.sub.uni-hamburg.de


Re: MoreLikeThis Component - how to get fields of documents

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Jan,

Which version of Solr are you using?

Regards,
Edwin


On 26 April 2016 at 23:46, Dr. Jan Frederik Maas <
jan.maas@sub.uni-hamburg.de> wrote:

> Hello,
>
> I want to use the moreLikeThis Component to get similar documents from a
> sharded SOLR. This works quite well except for the fact that the documents
> in the moreLikeThis-list only contain the id/unique key of the documents.
>
> Is it possible to get the other fields? I can of course do another query
> for the given IDs, but this would be complicated and very slow.
>
> For example:
>
>
> http://mysolrsystem/?q=id:524507260&mlt=true&mlt.fl=title&mlt.mintf=0&indent=true&mlt.match.include=true&fl=title,id,topic
>
> creates
>
> (...)
> <lst name="moreLikeThis">
> <result name="524507260" numFound="5" start="0" maxScore="4.583166">
> <doc><str name="id">646199803</str></doc>
> <doc><str name="id">613210832</str></doc>
> <doc><str name="id">562239472</str></doc>
> <doc><str name="id">819200034</str></doc>
> <doc><str name="id">539877271</str></doc>
> </result>
> (...)
>
> I tried to modify the fl-parameter, but I can only switch the ID-field in
> the moreLikeThis-Documents on and off (the latter resulting in empty
> document tags). In the result list however, the fl-fields are shown as
> specified.
>
> I would be very grateful for help.
>
> Best wishes,
> Jan Maas
>