You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by chrisbamford <ch...@chrisbamford.plus.com> on 2015/01/08 11:45:04 UTC
Filtering MoreLikeThis results
Hi,
I was wondering if Lucene supports applying a filter to an MLT search?
I believe that Solr can do it, but I'm not sure if Lucene can ..
A possible use case is "find me the 10 most similar documents to X
created in the last month".
Thanks
- Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Filtering MoreLikeThis results
Posted by Tomoko Uchida <to...@gmail.com>.
Hi,
> find me the 10 most similar documents
I suppose you mean "mlt.count" supported by MoreLikeThisComponent.
https://cwiki.apache.org/confluence/display/solr/MoreLikeThis
MLT is ordinary search in Lucene, so you get documents in order of
similarity (default scoring criteria) and can limit result size by "n"
parameter.
(With "mlt.count", however, Solr gets all possible docs, re-sorts and
truncates the list to merge and de-duplicate sharded results.)
> created in the last month
I wonder about solr supports such filtering for MLT, but with lucene, you
can specify Filters when you call search() method.
Just for information, here is the snippet.
MoreLikeThis mlt = new MoreLikeThis( ... );
mlt.setFieldNames( ... );
mlt.setAnalyzer( ... );
Query mltQuery = mlt.like( ... )
Filter filter = ...
TopDocs hits = searcher.search(mltQuery, filter, 10) // filter and limit
size
Regards
Tomoko
2015-01-08 19:45 GMT+09:00 chrisbamford <ch...@chrisbamford.plus.com>
:
> Hi,
>
> I was wondering if Lucene supports applying a filter to an MLT search? I
> believe that Solr can do it, but I'm not sure if Lucene can ..
>
> A possible use case is "find me the 10 most similar documents to X created
> in the last month".
>
> Thanks
>
> - Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>