Hi Markus,
I don't know why there aren't any results. But just out of curiosity,
why don't you use the better choice IntPoint.newExectQuery(String,int)?
What happens if you use that?
-Michael
Am 26.09.2017 um 13:22 schrieb Markus Jelsma:
> Hello,
>
> I have a QParser impl. that transforms text input to one or more integers, it
> makes a BooleanQuery one a field with all integers in OR-more. It used to
> work by transforming the integer using LegacyNumericUtils.intToPrefixCoded,
> getting a BytesRef.
>
> I have now moved it to use IntPoint.newRangeQuery(field, integer, integer), i
> read (think javadocs) this is the way to go, but i get no matches!
>
> Iterator<Integer> i = digests.iterator();
> while (i.hasNext()) {
> Integer digest = i.next();
> queryBuilder.add(IntPoint.newRangeQuery(field, digest, digest),
> Occur.SHOULD);
> }
> return queryBuilder.build();
>
> To be sure i didn't mess up elsewhere i also tried building a string for
> LuceneQParser and cheat:
>
> Iterator<Integer> i = digests.iterator();
> while (i.hasNext()) {
> Integer digest = i.next();
> str.append(ClientUtils.escapeQueryChars(digest.toString()));
> if (i.hasNext()) {
> str.append(" OR ");
> }
> }
> QParser luceneQParser = new LuceneQParser(str.append(")").toString(),
> localParams, params, req);
> return luceneQParser.parse();
>
> Well, this works! This is their respective debug output:
>
> Using the IntPoint range query:
>
> <result name="response" numFound="0" start="0">
> </result>
> <lst name="debug">
> <str name="rawquerystring">{!q f=d1}value</str>
> <str name="querystring">{!q f=d1}value</str>
> <str name="parsedquery">(d1:[-1820898630 TO -1820898630])</str>
> <str name="parsedquery_toString">d1:[-1820898630 TO -1820898630]</str>
>
> LuceneQParser cheat, it does find!
>
> <result name="response" numFound="2" start="0">
> <doc>
> <str name="id">1</str>
> <int name="d1">-1820898630</int></doc>
> </result>
> <lst name="debug">
> <str name="rawquerystring">{!qd f=d1}value</str>
> <str name="querystring">{!qd f=d1}value</str>
> <str name="parsedquery">d1:-1820898630</str>
>
> There is not much difference in output, it looks fine, using LuceneQParser
> you can also match using a range query, so what am i doing wrong?
>
> Many thanks!
> Markus
>