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 Elaine Li <el...@gmail.com> on 2011/07/07 21:44:30 UTC

can't get moreLikeThis to work

Hi Folks,

This is my configuration for mlt in solrconfig.xml
<requestHandler name="/mlt" class="org.apache.solr.handler.MoreLikeThisHandler">
    <lst name="defaults">
      <str name="mlt.fl">name,text,category_text</str>
      <int name="mlt.mintf">2</int>
      <int name="mlt.mindf">1</int>
      <int name="mlt.minwl">3</int>
      <int name="mlt.maxwl">1000</int>
      <int name="mlt.maxqt">50</int>
      <int name="mlt.maxntp">5000</int>
      <bool name="mlt.boost">true</bool>
      <str name="mlt.qf">name,text,category_text</str>
      <str name="mlt.interestingTerms"></str>
    </lst>
</requestHandler>

I also defined the three fields to have term_vectored attribute in schema.xml
<field name="name" type="text_nostem" indexed="true" stored="true"
term_vectored="true"/>
<field name="text" type="text_nostem" indexed="true" stored="false"
multiValued="true" term_vectored="true"/>
<field name="category_text" type="text_strip_id" indexed="true"
stored="false" multiValued="true" term_vectored="true"/>

When i submit the query
"http://localhost:8983/solr/mlt?q=id:69134&mlt.count=10", the return
only contains one document with id=69134.

Does anyone know or can guess what I missed? Thanks.

Elaine

Re: can't get moreLikeThis to work

Posted by Shawn Heisey <so...@elyograg.org>.
On 7/8/2011 8:08 AM, Elaine Li wrote:
> Guan and Koji, thank you both!
>
> After I changed to termVectors = true, it returns the results as expected.
> I flipped the stored=true|false for two fields: text and category_text
> and compared the results and don't see any difference. The
> documentation seems to suggest to have stored=true for the fields
> though, not sure why.

The way I understand what I've read, MLT requires termvectors to work, 
but if you don't have termvectors, it can use the stored field to 
calculate them on the fly.  If you need to store the field for other 
reasons, you could turn termVectors off and make your index smaller, at 
the expense of slower MLT queries.

This assumes I've understood things correctly!  I currently can't use 
MLT because it doesn't yet support distributed search.

Shawn


Re: can't get moreLikeThis to work

Posted by Erick Erickson <er...@gmail.com>.
What browser are you using? Chrome and FireFox (and I think IE) have
plugins that'll format XML and JSON right in the browser that helps with
this a lot.

Best
Erick

On Fri, Jul 8, 2011 at 10:08 AM, Elaine Li <el...@gmail.com> wrote:
> Guan and Koji, thank you both!
>
> After I changed to termVectors = true, it returns the results as expected.
> I flipped the stored=true|false for two fields: text and category_text
> and compared the results and don't see any difference. The
> documentation seems to suggest to have stored=true for the fields
> though, not sure why.
>
> The debugOn=true triggered debug message is a little difficult to read
> visually with everything in a big long string. After I turn on the
> wt=json, it becomes slight better with some spaces. Is there a
> hierarchical display of the debug message separated into multiple
> lines with indents so it is easier to digest?
>
> Elaine
>
> On Thu, Jul 7, 2011 at 8:48 PM, Koji Sekiguchi <ko...@r.email.ne.jp> wrote:
>> Plus, debugQuery=on would help you when using MLT after 3.1:
>>
>> https://issues.apache.org/jira/browse/SOLR-860
>>
>> koji
>> --
>> http://www.rondhuit.com/en/
>>
>> (11/07/08 6:55), Juan Grande wrote:
>>>
>>> Hi Elaine,
>>>
>>> The first thing that comes to my mind is that neither the content nor the
>>> term vectors of "text" and "category_text" fields are being stored. Check
>>> the name of the parameter used to store the term vectors, which actually
>>> is
>>> "termVectors" and not "term_vectored" (see
>>> http://wiki.apache.org/solr/SchemaXml#Expert_field_options).
>>>
>>> Try changing that and tell us if it worked!
>>>
>>> Regards,
>>>
>>> *Juan*
>>>
>>>
>>>
>>> On Thu, Jul 7, 2011 at 4:44 PM, Elaine Li<el...@gmail.com>
>>>  wrote:
>>>
>>>> Hi Folks,
>>>>
>>>> This is my configuration for mlt in solrconfig.xml
>>>> <requestHandler name="/mlt"
>>>> class="org.apache.solr.handler.MoreLikeThisHandler">
>>>>    <lst name="defaults">
>>>>      <str name="mlt.fl">name,text,category_text</str>
>>>>      <int name="mlt.mintf">2</int>
>>>>      <int name="mlt.mindf">1</int>
>>>>      <int name="mlt.minwl">3</int>
>>>>      <int name="mlt.maxwl">1000</int>
>>>>      <int name="mlt.maxqt">50</int>
>>>>      <int name="mlt.maxntp">5000</int>
>>>>      <bool name="mlt.boost">true</bool>
>>>>      <str name="mlt.qf">name,text,category_text</str>
>>>>      <str name="mlt.interestingTerms"></str>
>>>>    </lst>
>>>> </requestHandler>
>>>>
>>>> I also defined the three fields to have term_vectored attribute in
>>>> schema.xml
>>>> <field name="name" type="text_nostem" indexed="true" stored="true"
>>>> term_vectored="true"/>
>>>> <field name="text" type="text_nostem" indexed="true" stored="false"
>>>> multiValued="true" term_vectored="true"/>
>>>> <field name="category_text" type="text_strip_id" indexed="true"
>>>> stored="false" multiValued="true" term_vectored="true"/>
>>>>
>>>> When i submit the query
>>>> "http://localhost:8983/solr/mlt?q=id:69134&mlt.count=10", the return
>>>> only contains one document with id=69134.
>>>>
>>>> Does anyone know or can guess what I missed? Thanks.
>>>>
>>>> Elaine
>>>>
>>>
>>
>>
>>
>

Re: can't get moreLikeThis to work

Posted by Elaine Li <el...@gmail.com>.
> You can add the "indent=true" parameter to the request to get a tidier
> output. Firefox usually ignores tabs when showing XML, so I'd suggest to
> choose "View page source" in that case.
>
The page source looks so much better. :) thanks!

> The documentation seems to suggest to have stored=true for the fields
>> though, not sure why.
>>
>
> Maybe someone else can give more details here, but as I understand, if you
> store the term vectors, then MLT will use that information to compute
> similarity. If you don't store the term vectors, but you store the content,
> then MLT will iterate over the content of the field (more precisely, the
> first mlt.maxntp tokens) and generate the term vectors. In that case, the
> document is analyzed again, so it's a slower approach. If you don't store
> any of them, then you get no results :)
>

This makes sense. Just curious to know how much more space the term
vectors will take.
My 'text'(a product's description) can be very long, it can be 2K's
long paragraphs.
Is it crazy to create term vectors out of it?

Elaine

> On Fri, Jul 8, 2011 at 11:08 AM, Elaine Li <el...@gmail.com> wrote:
>
>> Guan and Koji, thank you both!
>>
>> After I changed to termVectors = true, it returns the results as expected.
>> I flipped the stored=true|false for two fields: text and category_text
>> and compared the results and don't see any difference. The
>> documentation seems to suggest to have stored=true for the fields
>> though, not sure why.
>>
>> The debugOn=true triggered debug message is a little difficult to read
>> visually with everything in a big long string. After I turn on the
>> wt=json, it becomes slight better with some spaces. Is there a
>> hierarchical display of the debug message separated into multiple
>> lines with indents so it is easier to digest?
>>
>> Elaine
>>
>> On Thu, Jul 7, 2011 at 8:48 PM, Koji Sekiguchi <ko...@r.email.ne.jp> wrote:
>> > Plus, debugQuery=on would help you when using MLT after 3.1:
>> >
>> > https://issues.apache.org/jira/browse/SOLR-860
>> >
>> > koji
>> > --
>> > http://www.rondhuit.com/en/
>> >
>> > (11/07/08 6:55), Juan Grande wrote:
>> >>
>> >> Hi Elaine,
>> >>
>> >> The first thing that comes to my mind is that neither the content nor
>> the
>> >> term vectors of "text" and "category_text" fields are being stored.
>> Check
>> >> the name of the parameter used to store the term vectors, which actually
>> >> is
>> >> "termVectors" and not "term_vectored" (see
>> >> http://wiki.apache.org/solr/SchemaXml#Expert_field_options).
>> >>
>> >> Try changing that and tell us if it worked!
>> >>
>> >> Regards,
>> >>
>> >> *Juan*
>> >>
>> >>
>> >>
>> >> On Thu, Jul 7, 2011 at 4:44 PM, Elaine Li<el...@gmail.com>
>> >>  wrote:
>> >>
>> >>> Hi Folks,
>> >>>
>> >>> This is my configuration for mlt in solrconfig.xml
>> >>> <requestHandler name="/mlt"
>> >>> class="org.apache.solr.handler.MoreLikeThisHandler">
>> >>>    <lst name="defaults">
>> >>>      <str name="mlt.fl">name,text,category_text</str>
>> >>>      <int name="mlt.mintf">2</int>
>> >>>      <int name="mlt.mindf">1</int>
>> >>>      <int name="mlt.minwl">3</int>
>> >>>      <int name="mlt.maxwl">1000</int>
>> >>>      <int name="mlt.maxqt">50</int>
>> >>>      <int name="mlt.maxntp">5000</int>
>> >>>      <bool name="mlt.boost">true</bool>
>> >>>      <str name="mlt.qf">name,text,category_text</str>
>> >>>      <str name="mlt.interestingTerms"></str>
>> >>>    </lst>
>> >>> </requestHandler>
>> >>>
>> >>> I also defined the three fields to have term_vectored attribute in
>> >>> schema.xml
>> >>> <field name="name" type="text_nostem" indexed="true" stored="true"
>> >>> term_vectored="true"/>
>> >>> <field name="text" type="text_nostem" indexed="true" stored="false"
>> >>> multiValued="true" term_vectored="true"/>
>> >>> <field name="category_text" type="text_strip_id" indexed="true"
>> >>> stored="false" multiValued="true" term_vectored="true"/>
>> >>>
>> >>> When i submit the query
>> >>> "http://localhost:8983/solr/mlt?q=id:69134&mlt.count=10", the return
>> >>> only contains one document with id=69134.
>> >>>
>> >>> Does anyone know or can guess what I missed? Thanks.
>> >>>
>> >>> Elaine
>> >>>
>> >>
>> >
>> >
>> >
>>
>

Re: can't get moreLikeThis to work

Posted by Juan Grande <ju...@gmail.com>.
Hi Elain,

You can add the "indent=true" parameter to the request to get a tidier
output. Firefox usually ignores tabs when showing XML, so I'd suggest to
choose "View page source" in that case.

The documentation seems to suggest to have stored=true for the fields
> though, not sure why.
>

Maybe someone else can give more details here, but as I understand, if you
store the term vectors, then MLT will use that information to compute
similarity. If you don't store the term vectors, but you store the content,
then MLT will iterate over the content of the field (more precisely, the
first mlt.maxntp tokens) and generate the term vectors. In that case, the
document is analyzed again, so it's a slower approach. If you don't store
any of them, then you get no results :)

*Juan*



On Fri, Jul 8, 2011 at 11:08 AM, Elaine Li <el...@gmail.com> wrote:

> Guan and Koji, thank you both!
>
> After I changed to termVectors = true, it returns the results as expected.
> I flipped the stored=true|false for two fields: text and category_text
> and compared the results and don't see any difference. The
> documentation seems to suggest to have stored=true for the fields
> though, not sure why.
>
> The debugOn=true triggered debug message is a little difficult to read
> visually with everything in a big long string. After I turn on the
> wt=json, it becomes slight better with some spaces. Is there a
> hierarchical display of the debug message separated into multiple
> lines with indents so it is easier to digest?
>
> Elaine
>
> On Thu, Jul 7, 2011 at 8:48 PM, Koji Sekiguchi <ko...@r.email.ne.jp> wrote:
> > Plus, debugQuery=on would help you when using MLT after 3.1:
> >
> > https://issues.apache.org/jira/browse/SOLR-860
> >
> > koji
> > --
> > http://www.rondhuit.com/en/
> >
> > (11/07/08 6:55), Juan Grande wrote:
> >>
> >> Hi Elaine,
> >>
> >> The first thing that comes to my mind is that neither the content nor
> the
> >> term vectors of "text" and "category_text" fields are being stored.
> Check
> >> the name of the parameter used to store the term vectors, which actually
> >> is
> >> "termVectors" and not "term_vectored" (see
> >> http://wiki.apache.org/solr/SchemaXml#Expert_field_options).
> >>
> >> Try changing that and tell us if it worked!
> >>
> >> Regards,
> >>
> >> *Juan*
> >>
> >>
> >>
> >> On Thu, Jul 7, 2011 at 4:44 PM, Elaine Li<el...@gmail.com>
> >>  wrote:
> >>
> >>> Hi Folks,
> >>>
> >>> This is my configuration for mlt in solrconfig.xml
> >>> <requestHandler name="/mlt"
> >>> class="org.apache.solr.handler.MoreLikeThisHandler">
> >>>    <lst name="defaults">
> >>>      <str name="mlt.fl">name,text,category_text</str>
> >>>      <int name="mlt.mintf">2</int>
> >>>      <int name="mlt.mindf">1</int>
> >>>      <int name="mlt.minwl">3</int>
> >>>      <int name="mlt.maxwl">1000</int>
> >>>      <int name="mlt.maxqt">50</int>
> >>>      <int name="mlt.maxntp">5000</int>
> >>>      <bool name="mlt.boost">true</bool>
> >>>      <str name="mlt.qf">name,text,category_text</str>
> >>>      <str name="mlt.interestingTerms"></str>
> >>>    </lst>
> >>> </requestHandler>
> >>>
> >>> I also defined the three fields to have term_vectored attribute in
> >>> schema.xml
> >>> <field name="name" type="text_nostem" indexed="true" stored="true"
> >>> term_vectored="true"/>
> >>> <field name="text" type="text_nostem" indexed="true" stored="false"
> >>> multiValued="true" term_vectored="true"/>
> >>> <field name="category_text" type="text_strip_id" indexed="true"
> >>> stored="false" multiValued="true" term_vectored="true"/>
> >>>
> >>> When i submit the query
> >>> "http://localhost:8983/solr/mlt?q=id:69134&mlt.count=10", the return
> >>> only contains one document with id=69134.
> >>>
> >>> Does anyone know or can guess what I missed? Thanks.
> >>>
> >>> Elaine
> >>>
> >>
> >
> >
> >
>

Re: can't get moreLikeThis to work

Posted by Elaine Li <el...@gmail.com>.
Guan and Koji, thank you both!

After I changed to termVectors = true, it returns the results as expected.
I flipped the stored=true|false for two fields: text and category_text
and compared the results and don't see any difference. The
documentation seems to suggest to have stored=true for the fields
though, not sure why.

The debugOn=true triggered debug message is a little difficult to read
visually with everything in a big long string. After I turn on the
wt=json, it becomes slight better with some spaces. Is there a
hierarchical display of the debug message separated into multiple
lines with indents so it is easier to digest?

Elaine

On Thu, Jul 7, 2011 at 8:48 PM, Koji Sekiguchi <ko...@r.email.ne.jp> wrote:
> Plus, debugQuery=on would help you when using MLT after 3.1:
>
> https://issues.apache.org/jira/browse/SOLR-860
>
> koji
> --
> http://www.rondhuit.com/en/
>
> (11/07/08 6:55), Juan Grande wrote:
>>
>> Hi Elaine,
>>
>> The first thing that comes to my mind is that neither the content nor the
>> term vectors of "text" and "category_text" fields are being stored. Check
>> the name of the parameter used to store the term vectors, which actually
>> is
>> "termVectors" and not "term_vectored" (see
>> http://wiki.apache.org/solr/SchemaXml#Expert_field_options).
>>
>> Try changing that and tell us if it worked!
>>
>> Regards,
>>
>> *Juan*
>>
>>
>>
>> On Thu, Jul 7, 2011 at 4:44 PM, Elaine Li<el...@gmail.com>
>>  wrote:
>>
>>> Hi Folks,
>>>
>>> This is my configuration for mlt in solrconfig.xml
>>> <requestHandler name="/mlt"
>>> class="org.apache.solr.handler.MoreLikeThisHandler">
>>>    <lst name="defaults">
>>>      <str name="mlt.fl">name,text,category_text</str>
>>>      <int name="mlt.mintf">2</int>
>>>      <int name="mlt.mindf">1</int>
>>>      <int name="mlt.minwl">3</int>
>>>      <int name="mlt.maxwl">1000</int>
>>>      <int name="mlt.maxqt">50</int>
>>>      <int name="mlt.maxntp">5000</int>
>>>      <bool name="mlt.boost">true</bool>
>>>      <str name="mlt.qf">name,text,category_text</str>
>>>      <str name="mlt.interestingTerms"></str>
>>>    </lst>
>>> </requestHandler>
>>>
>>> I also defined the three fields to have term_vectored attribute in
>>> schema.xml
>>> <field name="name" type="text_nostem" indexed="true" stored="true"
>>> term_vectored="true"/>
>>> <field name="text" type="text_nostem" indexed="true" stored="false"
>>> multiValued="true" term_vectored="true"/>
>>> <field name="category_text" type="text_strip_id" indexed="true"
>>> stored="false" multiValued="true" term_vectored="true"/>
>>>
>>> When i submit the query
>>> "http://localhost:8983/solr/mlt?q=id:69134&mlt.count=10", the return
>>> only contains one document with id=69134.
>>>
>>> Does anyone know or can guess what I missed? Thanks.
>>>
>>> Elaine
>>>
>>
>
>
>

Re: can't get moreLikeThis to work

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Plus, debugQuery=on would help you when using MLT after 3.1:

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

koji
-- 
http://www.rondhuit.com/en/

(11/07/08 6:55), Juan Grande wrote:
> Hi Elaine,
>
> The first thing that comes to my mind is that neither the content nor the
> term vectors of "text" and "category_text" fields are being stored. Check
> the name of the parameter used to store the term vectors, which actually is
> "termVectors" and not "term_vectored" (see
> http://wiki.apache.org/solr/SchemaXml#Expert_field_options).
>
> Try changing that and tell us if it worked!
>
> Regards,
>
> *Juan*
>
>
>
> On Thu, Jul 7, 2011 at 4:44 PM, Elaine Li<el...@gmail.com>  wrote:
>
>> Hi Folks,
>>
>> This is my configuration for mlt in solrconfig.xml
>> <requestHandler name="/mlt"
>> class="org.apache.solr.handler.MoreLikeThisHandler">
>>     <lst name="defaults">
>>       <str name="mlt.fl">name,text,category_text</str>
>>       <int name="mlt.mintf">2</int>
>>       <int name="mlt.mindf">1</int>
>>       <int name="mlt.minwl">3</int>
>>       <int name="mlt.maxwl">1000</int>
>>       <int name="mlt.maxqt">50</int>
>>       <int name="mlt.maxntp">5000</int>
>>       <bool name="mlt.boost">true</bool>
>>       <str name="mlt.qf">name,text,category_text</str>
>>       <str name="mlt.interestingTerms"></str>
>>     </lst>
>> </requestHandler>
>>
>> I also defined the three fields to have term_vectored attribute in
>> schema.xml
>> <field name="name" type="text_nostem" indexed="true" stored="true"
>> term_vectored="true"/>
>> <field name="text" type="text_nostem" indexed="true" stored="false"
>> multiValued="true" term_vectored="true"/>
>> <field name="category_text" type="text_strip_id" indexed="true"
>> stored="false" multiValued="true" term_vectored="true"/>
>>
>> When i submit the query
>> "http://localhost:8983/solr/mlt?q=id:69134&mlt.count=10", the return
>> only contains one document with id=69134.
>>
>> Does anyone know or can guess what I missed? Thanks.
>>
>> Elaine
>>
>



Re: can't get moreLikeThis to work

Posted by Juan Grande <ju...@gmail.com>.
Hi Elaine,

The first thing that comes to my mind is that neither the content nor the
term vectors of "text" and "category_text" fields are being stored. Check
the name of the parameter used to store the term vectors, which actually is
"termVectors" and not "term_vectored" (see
http://wiki.apache.org/solr/SchemaXml#Expert_field_options).

Try changing that and tell us if it worked!

Regards,

*Juan*



On Thu, Jul 7, 2011 at 4:44 PM, Elaine Li <el...@gmail.com> wrote:

> Hi Folks,
>
> This is my configuration for mlt in solrconfig.xml
> <requestHandler name="/mlt"
> class="org.apache.solr.handler.MoreLikeThisHandler">
>    <lst name="defaults">
>      <str name="mlt.fl">name,text,category_text</str>
>      <int name="mlt.mintf">2</int>
>      <int name="mlt.mindf">1</int>
>      <int name="mlt.minwl">3</int>
>      <int name="mlt.maxwl">1000</int>
>      <int name="mlt.maxqt">50</int>
>      <int name="mlt.maxntp">5000</int>
>      <bool name="mlt.boost">true</bool>
>      <str name="mlt.qf">name,text,category_text</str>
>      <str name="mlt.interestingTerms"></str>
>    </lst>
> </requestHandler>
>
> I also defined the three fields to have term_vectored attribute in
> schema.xml
> <field name="name" type="text_nostem" indexed="true" stored="true"
> term_vectored="true"/>
> <field name="text" type="text_nostem" indexed="true" stored="false"
> multiValued="true" term_vectored="true"/>
> <field name="category_text" type="text_strip_id" indexed="true"
> stored="false" multiValued="true" term_vectored="true"/>
>
> When i submit the query
> "http://localhost:8983/solr/mlt?q=id:69134&mlt.count=10", the return
> only contains one document with id=69134.
>
> Does anyone know or can guess what I missed? Thanks.
>
> Elaine
>