Thank you!  I tried (pg_int:"-1") and (pg_int:\-1) and they both worked (I got 
118 results back as expected).

The field pg_int is defined as follows:

<field name="pg_int" type="tint" indexed="true" stored="true" omitNorms="true"/>

<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" 
positionIncrementGap="0"
                   sortMissingLast="true"/>


Rebecca
________________________________________
From: Jack Krupansky [jack.krupan...@gmail.com]
Sent: Saturday, February 21, 2015 3:04 PM
To: solr-user@lucene.apache.org
Subject: Re: edismax removes query string: (pg_int:-1) becomes ()

I would classify this behavior as a bug, even if we can explain it somehow
- it is certainly not intuitively expected.

As a workaround, try placing the -1 in quotes: (pg_int:"-1"). Or escape the
minus with a backslash: (pg_int:\-1)

Also, what is the field and field type for pg_int?

The edismax query parser has a few too many parsing heuristics, causing way
too many odd combinations that are not exhaustively tested.


-- Jack Krupansky

On Sat, Feb 21, 2015 at 5:43 PM, Tang, Rebecca <rebecca.t...@ucsf.edu>
wrote:

> Hi there,
>
> I have a field pg_int which is number of pages stored as integer.  There
> are 118 records in my index with pg_int = -1.
>
> If I search the index with pg_int:-1, I get the correct records returned
> in the results.
> { "responseHeader": { "status": 0, "QTime": 1, "params": { "debugQuery":
> "true", "indent": "true", "q": "pg_int:-1\n", "_": "1424558304272", "wt":
> "json", "rows": "0" } }, "response": { "numFound": 118, "start": 0, "docs":
> [] }, "moreLikeThis": {}, "highlighting": {}, "debug": { "moreLikeThis":
> {}, "rawquerystring": "pg_int:-1\n", "querystring": "pg_int:-1\n",
> "parsedquery": "(+pg_int:-1)/no_coord", "parsedquery_toString":
> "+pg_int:`\u0007    ", "explain": {}, "QParser": "ExtendedDismaxQParser",
>
> But if I put parens around the query and send it over to solr as
> (pg_int:-1), then the query string gets completely removed by the edimax
> parser:
> { "responseHeader": { "status": 0, "QTime": 1, "params": { "debugQuery":
> "true", "indent": "true", "q": "(pg_int:-1)\n", "_": "1424558355671", "wt":
> "json", "rows": "0" } }, "response": { "numFound": 0, "start": 0, "docs":
> [] }, "moreLikeThis": {}, "highlighting": {}, "debug": { "moreLikeThis":
> {}, "rawquerystring": "(pg_int:-1)\n", "querystring": "(pg_int:-1)\n",
> "parsedquery": "(+())/no_coord", <-------- query string is removed
> "parsedquery_toString": "+()", "explain": {}, "QParser":
> "ExtendedDismaxQParser",
>
>
> I don't understand what could be causing this.  It doesn't happen to
> positive integers.  Both pg_int:1 and (pg_int:1) work fine.
>
> Has anyone run into this issue?  How do I get around it?
>
> Thanks,
> Rebecca
>

Reply via email to