lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: Range query rewrite incorrect
Date Mon, 21 Mar 2011 17:46:37 GMT
That's all correct, the rewrite is done like this, what comes out after
rewrite is purely internal and may change from query to query or index to
index (as the best rewrite method is chosen from your index contents).

Your query has one problem: Lucene only works with "string" ranges that way
how you use it, so a pure numeric range without padding the terms cannot

If you want real numeric queries, use NumericRangeQuery in combination with
NumericField. But QueryParser cannot handle the so you have to build the
queries from code (instantiate NumericRangeQuerxy in your code).

Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen

> -----Original Message-----
> From: jpogorman []
> Sent: Monday, March 21, 2011 6:14 PM
> To:
> Subject: Range query rewrite incorrect
> Hello,
> I have a range query like this...
> TYPE:DOCUMENT AND docSize:[0 TO 1048576]
> I'm using the MultiFieldQueryParser and when I call Rewrite on this I get
> the following text...
> +TYPE:document +ConstantScore(QueryWrapperFilter())
> This text will not return any results and I am not sure where the
> QueryWrapperFilter() portion of text has come from. It has something to do
> with the 1048576 value and similar values.
> If I search using TYPE:DOCUMENT AND docSize:[0 TO 500] the rewrite will
> generate a query that works...
> +TYPE:document +ConstantScore(docSize:[0 TO 500])
> Can anyone shed some light on why this is happening and how to avoid it?
> Thanks,
> JP
> --
> View this message in context:
> query-rewrite-incorrect-tp2710807p2710807.html
> Sent from the Lucene - General mailing list archive at

View raw message