You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by bu...@apache.org on 2001/10/18 02:00:24 UTC

DO NOT REPLY [Bug 4254] New: - QueryParser does not recognized negative numbers...

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4254>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4254

QueryParser does not recognized negative numbers...

           Summary: QueryParser does not recognized negative numbers...
           Product: Lucene
           Version: CVS Nightly - Specify date in submission
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: QueryParser
        AssignedTo: lucene-dev@jakarta.apache.org
        ReportedBy: alex.paransky@individualnetwork.com


The TermQuery allows .setBost to set a float multiplier.  The boost is entered 
via a '^'<NUMBER> format in the String query, however, while .setBoost will 
take a negative number, the parser does not allow negative numbers due to the 
limited description of the <NUMBER> token (QueryParser.jj):

| <NUMBER:     (<_NUM_CHAR>)+ "." (<_NUM_CHAR>)+ >

The solution is to allow + or - as in:

| <NUMBER:    (["+","-"])? (<_NUM_CHAR>)+ "." (<_NUM_CHAR>)+ >

This works correctly, properly reading negative numbers.  

I have done some simple tests, and negative boost seems to work as expected, by 
moving the entry to the end of the list.