lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/queryParser QueryParser.jj
Date Thu, 01 Nov 2001 18:21:02 GMT
cutting     01/11/01 10:21:02

  Modified:    src/java/org/apache/lucene/queryParser QueryParser.jj
  Log:
  Changed so that PrefixQuery is used in preference to WildcardQuery
  when there's only an asterisk at the end of the term.  Previously
  PrefixQuery would never be used.
  
  Also removed some unused token rules.
  
  Revision  Changes    Path
  1.5       +6 -9      jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.jj
  
  Index: QueryParser.jj
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.jj,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- QueryParser.jj	2001/11/01 01:12:37	1.4
  +++ QueryParser.jj	2001/11/01 18:21:02	1.5
  @@ -254,15 +254,10 @@
   /* ***************** */
   
   <*> TOKEN : {
  -  <#_ALPHA_CHAR: ["a"-"z", "A"-"Z"] >
  -| <#_NUM_CHAR:   ["0"-"9"] >
  -| <#_ALPHANUM_CHAR: [ "a"-"z", "A"-"Z", "0"-"9" ] >
  +  <#_NUM_CHAR:   ["0"-"9"] >
   | <#_TERM_START_CHAR: [ "a"-"z", "A"-"Z", "_", "\u0080"-"\uFFFE" ] >
   | <#_TERM_CHAR: [ "a"-"z", "A"-"Z", "0"-"9", "_", "\u0080"-"\uFFFE" ] >
  -| <#_NEWLINE:    ( "\r\n" | "\r" | "\n" ) >
   | <#_WHITESPACE: ( " " | "\t" ) >
  -| <#_QCHAR:      ( "\\" (<_NEWLINE> | ~["a"-"z", "A"-"Z", "0"-"9"] ) ) >
  -| <#_RESTOFLINE: (~["\r", "\n"])* >
   }
   
   <DEFAULT> TOKEN : {
  @@ -275,11 +270,11 @@
   | <RPAREN:    ")" >
   | <COLON:     ":" >
   | <CARAT:     "^" >
  -| <STAR:      "*" >
   | <QUOTED:     "\"" (~["\""])+ "\"">
   | <NUMBER:    (<_NUM_CHAR>)+ ( "." (<_NUM_CHAR>)+ )? >
   | <TERM:      <_TERM_START_CHAR> (<_TERM_CHAR>)*  >
   | <FUZZY:     "~" >
  +| <PREFIXTERM:  <_TERM_START_CHAR> (<_TERM_CHAR>)* "*" >
   | <WILDTERM:  <_TERM_START_CHAR> 
                 (<_TERM_CHAR> | ( [ "*", "?" ] ))* >
   | <RANGEIN:   "[" (~["]"])+ "]">
  @@ -369,16 +364,18 @@
     ( 
        (
          term=<TERM>
  +       | term=<PREFIXTERM> { prefix=true; }
          | term=<WILDTERM> { wildcard=true; }
          | term=<NUMBER>
        )
  -     [ <STAR> { prefix=true; } | <FUZZY> { fuzzy=true; } ]
  +     [ <FUZZY> { fuzzy=true; } ]
        [ <CARAT> boost=<NUMBER> ]
        { 
          if (wildcard)
            q = new WildcardQuery(new Term(field, term.image));
          else if (prefix) 
  -         q = new PrefixQuery(new Term(field, term.image));
  +         q = new PrefixQuery(new Term(field, term.image.substring
  +                                      (0, term.image.length()-1)));
          else if (fuzzy)
            q = new FuzzyQuery(new Term(field, term.image));
          else
  
  
  

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message