ryantxu / spatial-solr-sandbox

A demo web-app for Lucene spatial, plus some extra spatial implementations that use LGPL libs (JTS).
Apache License 2.0
25 stars 11 forks source link

JtsGeoStratey's filter should implement Bits instead of testing all documents #3

Open dsmiley opened 11 years ago

dsmiley commented 11 years ago

I can tell JtsGeoStrategy's filter is so slow just by looking at it. It's testing all indexed documents and returning a bitset. Talk about brute-force! Instead, it should return a DocIdSet that returns a Bits that in turn will test the given document to see if it matches. If that isn't work, then a superior approach is one that returns a DocIdSetIterator that implements advance(). In this way, the expensive logic will only occur for documents that match other aspects of the query (e.g. keyword, other filter queries). In Solr, this would be used as a post-filter with a cost >= 100.