Changing Bits: Fast search filters using flex
Fast search filters using flex A filter in Lucene is a bit set that restricts the search space for any query; you pass it into IndexSearcher's search method. It's effective for a number of use cases, such as document security, index partitions, facet drill-down, etc. To apply a filter, Lucene must compute the intersection of the documents matching the query against the documents allowed by the filter. Today, we do that in IndexSearcher like this: while (true) { if (scorerDoc == DocIdSetIterator.NO_MORE_DOCS) { } } We call this the "leapfrog approach": the query and the filter take turns trying to advance to each other's next matching document, often jumping past the target document. When both land on the same document, it's collected. Unfortunately, for various reasons this implementation is inefficient (these are spelled out more in LUCENE-1536 ): The advance method for most queries is costly. The advance method for most filters is usually cheap.Read full article from Changing Bits: Fast search filters using flex
No comments:
Post a Comment