Argh .. I more carefully read Query.extractTerns javadocs:

"Only works if this query is in its {@link #rewrite rewritten} form."

Sorry for the disturbance :).

Shai

On Fri, Dec 16, 2011 at 6:54 AM, Robert Muir <[email protected]> wrote:

> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to