lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 4254] New: - QueryParser does not recognized negative numbers...
Date Thu, 18 Oct 2001 00:00:24 GMT
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.

Mime
View raw message