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 Andrew Ingram <an...@andrewingram.net> on 2009/01/19 14:49:55 UTC

MoreLikeThis/These and Queries

Hi,

I'm using Solr's MoreLikeThese functionality for a rudimentary related 
products system, but we need it to only return related products that 
match certain criteria. For example, we don't want to see any related 
products that are discontinued. I'm having difficulty figuring out if 
there's a way to filter/query on the MLT result.

Regards,
Andrew Ingram

Re: MoreLikeThis/These and Queries

Posted by Clas Rydergren <ni...@gmail.com>.
Ah, I see. I have, more or less, only used the MoreLikeThis (single
document) version, and the fq-filter is then applied to the (only)
query that is made. Sorry.

/Clas





On Mon, Jan 19, 2009 at 4:42 PM, Andrew Ingram <an...@andrewingram.net> wrote:
> Thanks, I'll try this.
>
> I tried using the /select version and the problem was that fq applies only
> to the original query rather than the mlt results which are effectively
> separate queries.
>
>
> Clas Rydergren wrote:
>>
>> Hi,
>>
>> Even if you use the /solr/select-version of MLT, I guess that just
>> adding the fq-parameter may work.
>>
>> If you would like to add the MLT request handler, add something like
>>
>> <requestHandler name="mlt" class="solr.MoreLikeThisHandler">
>>    <lst name="defaults">
>>      <str name="mlt.fl">title,data</str>
>>      <int name="mlt.mindf">1</int>
>>    </lst>
>>  </requestHandler>
>>
>> as a request handler plugin in your solrconfig.xml file. If you are
>> running on Tomcat you will have to make adjustments to you
>> web.xml-file.
>>
>> /Clas, Frisim.com
>>
>

Re: MoreLikeThis/These and Queries

Posted by Andrew Ingram <an...@andrewingram.net>.
Thanks, I'll try this.

I tried using the /select version and the problem was that fq applies 
only to the original query rather than the mlt results which are 
effectively separate queries.


Clas Rydergren wrote:
> Hi,
>
> Even if you use the /solr/select-version of MLT, I guess that just
> adding the fq-parameter may work.
>
> If you would like to add the MLT request handler, add something like
>
> <requestHandler name="mlt" class="solr.MoreLikeThisHandler">
>     <lst name="defaults">
>       <str name="mlt.fl">title,data</str>
>       <int name="mlt.mindf">1</int>
>     </lst>
>   </requestHandler>
>
> as a request handler plugin in your solrconfig.xml file. If you are
> running on Tomcat you will have to make adjustments to you
> web.xml-file.
>
> /Clas, Frisim.com
>   

Re: MoreLikeThis/These and Queries

Posted by Clas Rydergren <ni...@gmail.com>.
Hi,

Even if you use the /solr/select-version of MLT, I guess that just
adding the fq-parameter may work.

If you would like to add the MLT request handler, add something like

<requestHandler name="mlt" class="solr.MoreLikeThisHandler">
    <lst name="defaults">
      <str name="mlt.fl">title,data</str>
      <int name="mlt.mindf">1</int>
    </lst>
  </requestHandler>

as a request handler plugin in your solrconfig.xml file. If you are
running on Tomcat you will have to make adjustments to you
web.xml-file.

/Clas, Frisim.com


On Mon, Jan 19, 2009 at 3:15 PM, Andrew Ingram <an...@andrewingram.net> wrote:
> I think the problem might be that I'm using the standard handler with the
> mlt:true parameter. The MLT handler doesn't seem to be mentioned in my
> config file, do you know how I can enable it?
>
> Regards,
> Andrew Ingram
>
> Clas Rydergren wrote:
>>
>> Hi,
>>
>> Have you tried to add a filter directly to the /solr/mlt?q=-request?
>> Try to add "&fq=available:yes", and see if you can limit the
>> MoreLikeThis-documents to documents that has "yes" in the
>> "available"-field. I have had some success with this approach.
>>
>> /Clas, Frisim.com
>>
>

Re: MoreLikeThis/These and Queries

Posted by Andrew Ingram <an...@andrewingram.net>.
I think the problem might be that I'm using the standard handler with 
the mlt:true parameter. The MLT handler doesn't seem to be mentioned in 
my config file, do you know how I can enable it?

Regards,
Andrew Ingram

Clas Rydergren wrote:
> Hi,
>
> Have you tried to add a filter directly to the /solr/mlt?q=-request?
> Try to add "&fq=available:yes", and see if you can limit the
> MoreLikeThis-documents to documents that has "yes" in the
> "available"-field. I have had some success with this approach.
>
> /Clas, Frisim.com
>   

Re: MoreLikeThis/These and Queries

Posted by Clas Rydergren <ni...@gmail.com>.
Hi,

Have you tried to add a filter directly to the /solr/mlt?q=-request?
Try to add "&fq=available:yes", and see if you can limit the
MoreLikeThis-documents to documents that has "yes" in the
"available"-field. I have had some success with this approach.

/Clas, Frisim.com



On Mon, Jan 19, 2009 at 2:49 PM, Andrew Ingram <an...@andrewingram.net> wrote:
> Hi,
>
> I'm using Solr's MoreLikeThese functionality for a rudimentary related
> products system, but we need it to only return related products that match
> certain criteria. For example, we don't want to see any related products
> that are discontinued. I'm having difficulty figuring out if there's a way
> to filter/query on the MLT result.
>
> Regards,
> Andrew Ingram
>