On Thursday 23 March 2006 20:51, Tom Hill wrote: > Hi - > > I have an application where I'm using Lucene to index the contents of > a database. That's working fine. > > But I have a problem where I'd like to retrieve a subset of the > documents that match a search, based on a join table in the database. > > How do people typically handle combining the results of a Lucene > based search with the results of a database search?
One way is to get the values of some key field from the database, create a Filter using terms created from these values, and use that Filter in a search, or in a FilteredQuery. See RangeFilter.bits() for some example code that creates a filter from terms. Sorting the key values beforehand helps performance for creating the filter. CachingWrapperFilter can also be handy. In case you need a lot of filters for relatively few documents, have a look here: http://issues.apache.org/jira/browse/LUCENE-328 Regards, Paul Elschot --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]