Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limiting the output from MoreLikeThis in Solr

I'm trying to use MoreLikeThis to get all similar documents but not documents with a specific contenttype.

So the first query needs to find the one document that I want to get "More Like This" of - and the second query needs to limit the similar documents to not be pdf's (-contenttype:pdf)

Does anyone know if this is possible?

Thanks

like image 665
Svenn Avatar asked Nov 19 '10 13:11

Svenn


1 Answers

When using the MoreLikeThisHandler, all the common parameters applied to the mlt results set. So you can use the fq parameter to exclude your pdf documents from the mlt results:

http://localhost:8983/solr/mlt?q=test&mlt.fl=text&fq=-contenttype:pdf

The q parameter allows to select the document to generate mlt results (actually, it's the first document matching the initial query that is used).

like image 92
Pascal Dimassimo Avatar answered Sep 16 '22 18:09

Pascal Dimassimo