: If you went with the FunctionQuery approach for sorting by distance, would : there be any way to use the output of the FunctionQuery to limit the : documents to those within a certain radius? Or is it just for boosting : documents, not for filtering?
FunctionQueries don't restrict the set of documents at all, so you would need to combine it with a seperate query that limits the documents ... the simplest way would be as you say: by combining it with two range queries that would define a lat/lon "bounding box" : Also, even if you're just using it for boosting, is there a way to avoid : running the expensive function on all docs in the index? Could you somehow that's the bueaty of "skipTo" in query scoring ... BooleanQueries keep track of the "next" document each clause can match (in order by docid), and tell all of the other queries to "skipTo" that doc and not bother trying to score any doc ids below that. -Hoss