lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomoko Uchida <tomoko.uchida.1...@gmail.com>
Subject Re: Filtering MoreLikeThis results
Date Fri, 09 Jan 2015 15:00:58 GMT
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 <chrisbamford@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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message