lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <markharw...@yahoo.co.uk>
Subject Re: how best to limit search result to a subset of document ids?
Date Fri, 14 Sep 2007 16:15:15 GMT
Hi Chris,

Have a look at the "TermsFilter" in contrib/queries.
The code would look something like this:

    TermsFilter filter=new TermsFilter()
//    for( all 5 id terms....
      filter.addTerm(new Term("id", id[i]));
  
   hits=searcher.search(moreLikeThisQuery, filter);


Cheers
Mark

----- Original Message ----
From: Chris Sizemore <Chris.Sizemore@bbc.co.uk>
To: java-user@lucene.apache.org
Sent: Friday, 14 September, 2007 4:45:43 PM
Subject: how best to limit search result to a subset of document ids?


hello--

i'm trying to figure out the best way to limit a query to a small subset if a lucene index's
documents, and i'm a bit of a novice and a bit stumped...

my scenario is:

1) search the index for a term (very boring normal case)
2) take the top 5 results from that search result set 
3) next, do a MoreLikeThis query where ONLY those 5 documents are valid to search against
(BTW, the MLT query is based on a separately supplied doc which needs to be compared)

hoping this scenario makes some sense...

should i put together a boolean query with the 5 doc ids, a la:

"id:282707 OR id:389447"

or should i try to set up a QueryFilter with a list of document ids? and any pointers as to
what the syntax should be to add doc ids to a QueryFilter?

also, is it possible that Lucene in Action (which i have) is a bit out of date in this area
now?

any thoughts would be greatly appreciated...


best--

--chris sizemore

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are
not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify
the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                    





      ___________________________________________________________ 
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message