Instead of this:

MoreLikeThis mlt = new MoreLikeThis(ir);
Reader target = ... // orig source of doc you want to find similarities to
Query query = mlt.like( target);
Hits hits = is.search(query);

do this:

MoreLikeThis mlt = new MoreLikeThis(ir);
Reader target = ... // orig source of doc you want to find similarities to
Query moreQuery = mlt.like( target);
BooleanQuery bq = new BooleanQuery();
bq.add(moreQuery, BooleanClause.Occur.MUST);
Query restrictQuery = new TermQuery(new Term("Category", "A"));
bq.add(restrictQuery, BooleanClause.Occur.MUST);
Hits hits = is.search(bq);

-glen

2008/4/22 Jonathan Ariel <[EMAIL PROTECTED]>:
> Is there any way to execute a MoreLikeThis over a subset of documents? I
>  need to retrieve a set of interesting keywords from a subset of documents
>  and not the entire index (imagine that my index has documents categorized as
>  A, B and C and I just want to work with those categorized as A). Right now
>  it is using docFreq from the IndexReader. So I looked into the
>  FilterIndexReader to see if I can override the docFreq behavior, but I'm not
>  sure if it's possible.
>
>  What do you think?
>
>  Jonathan
>



-- 

-

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to