Another way is to use the trunk, where Scorer is a subclass of DocIdSetIterator, which is returned by a Filter. This allows to create a TermFilter that returns a TermScorer (which is based on TermEnum internally.)
Try wrapping it in a CachingWrapperFilter when it needs to be reused. Finally, have a look here to see whether it could help in your case: https://issues.apache.org/jira/browse/LUCENE-1296 Regards, Paul Elschot Op Wednesday 03 September 2008 18:00:27 schreef mark harwood: > One way is to read TermDocs for each candidate term and see if they > are in your filter - but that sounds like a lot of disk IO to me when > responding to individual user keystrokes. You can use "skip" to avoid > reading all term docs when you know what is in the filter but it all > seems a bit costly. > > It's hard to optimise in advance for this, especially if the filter > is an arbitrary choice of documents for each user. > > > > ----- Original Message ---- > From: AdrianPillinger <[EMAIL PROTECTED]> > To: java-dev@lucene.apache.org > Sent: Wednesday, 3 September, 2008 16:54:11 > Subject: Can I filter the results returned by > IndexReader.terms(term)? > > > I am using IndexReader.terms(term) to produce term suggestions to my > users as they type. In many cases the user is searching lucene with a > filter applied, for example a date range. > > Is there any way I can get a list of terms in the index that are > contained within a subset of the documents by a given filter. > > i.e. I'd like to do something like.... > > ... > IndexReader reader = readerProvider.openReader(directoryProvider); > reader.filterDocument(filter); > TermEnum termEnum = reader.terms(new Term("name", "<user entered > term>")); ...Iterate on terms > .... > > > I've scouted all over the API and I cannot find how to do this or if > it is possible. > > Please let me know if it can be done and if so how. > > Thanks! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]