Home | About | Sematext search-lucene.com search-hadoop.com
 Search Lucene and all its subprojects:

Switch to Threaded View
Lucene, mail # dev - NumericRangeQuery.extractTerms and distributed stats


Copy link to this message
-
Re: NumericRangeQuery.extractTerms and distributed stats
Robert Muir 2011-12-16, 04:54
On Thu, Dec 15, 2011 at 11:46 PM, Shai Erera <[EMAIL PROTECTED]> wrote:
> Hi
>
> For the purpose of running a distributed search and fix the local term
> statistics to be the global one, we do the following:
>
> (1) Receive a query String and parse into a Query object
> (2) Call q.extractTerms()
> (3) Fetch stats from each Searcher (forget about caching at the moment)
> (4) Transmit the fixed statistics to all searchers so they fix their local
> stats with the global ones.
>
> If the query contains a range clause, extractTerms() throws
> UnsupportedOperationException, because NumericRangeQuery (and MTQ) do not
> override Query.extractTerms. I understand that the numeric range terms are
> meaningless, and so I would at least expect it to not do anything, rather
> than throw UOE. Throwing an exception IMO is too drastic for this operation,
> and it prevents useful functionality.

I think the exception is correct, you need to call extractTerms after rewrite()

Mike has a cool test on https://issues.apache.org/jira/browse/LUCENE-3639,
and if i recall it tests multitermqueries.

currently his searcher overrides IS.rewrite():

@Override rewrite(Query q) {
   Query rewritten = super.rewrite(q);
   terms = rewritten.extractTerms();
   ...
   return rewritten;
}

i added some comments on there about how its all still a bit funky and
am hoping we can still make this easier in trunk.

--
lucidimagination.com

---------------------------------------------------------------------