You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by go...@apache.org on 2004/10/11 15:36:14 UTC

cvs commit: jakarta-lucene/src/java/org/apache/lucene/queryParser QueryParser.java QueryParser.jj

goller      2004/10/11 06:36:14

  Modified:    src/java/org/apache/lucene/queryParser Tag: lucene_1_4_2_dev
                        QueryParser.java QueryParser.jj
  Log:
  Reinsert old API for
  getFieldQuery
  getRangeQuery
  getFuzzyQuery
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.11.2.2  +48 -5     jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.java
  
  Index: QueryParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.java,v
  retrieving revision 1.11.2.1
  retrieving revision 1.11.2.2
  diff -u -r1.11.2.1 -r1.11.2.2
  --- QueryParser.java	1 Oct 2004 09:59:23 -0000	1.11.2.1
  +++ QueryParser.java	11 Oct 2004 13:36:14 -0000	1.11.2.2
  @@ -244,6 +244,16 @@
     }
   
     /**
  +   * Parameter analyzer is ignored.
  +   * @deprecated use {@link #getFieldQuery(String, String)}
  +   */
  +  protected Query getFieldQuery(String field,
  +                                                    Analyzer analyzer,
  +                                                    String queryText)  throws ParseException {
  +    return getFieldQuery(field, queryText);
  +  }
  +
  +  /**
      * @exception ParseException throw in overridden method to disallow
      */
     protected Query getFieldQuery(String field, String queryText)  throws ParseException {
  @@ -288,6 +298,17 @@
     }
   
     /**
  +   * Parameter analyzer is ignored.
  +   * @deprecated use {@link #getFieldQuery(String, String, int)}
  +   */
  +  protected Query getFieldQuery(String field,
  +                                                    Analyzer analyzer,
  +                                                    String queryText,
  +                                                    int slop) throws ParseException {
  +    return getFieldQuery(field, queryText, slop);
  +  }
  +
  +  /**
      * Base implementation delegates to {@link #getFieldQuery(String,String)}.
      * This method may be overridden, for example, to return
      * a SpanNearQuery instead of a PhraseQuery.
  @@ -306,6 +327,18 @@
     }
   
     /**
  +   * Parameter analyzer is ignored.
  +   * @deprecated use {@link #getRangeQuery(String, String, String, boolean)}
  +   */
  +  protected Query getRangeQuery(String field,
  +      Analyzer analyzer,
  +      String part1,
  +      String part2,
  +      boolean inclusive) throws ParseException {
  +    return getRangeQuery(field, part1, part2, inclusive);
  +  }
  +
  +  /**
      * @exception ParseException throw in overridden method to disallow
      */
     protected Query getRangeQuery(String field,
  @@ -412,6 +445,13 @@
       return new PrefixQuery(t);
     }
   
  + /**
  +   * @deprecated use {@link #getFuzzyQuery(String, String, float)}
  +   */
  +  protected Query getFuzzyQuery(String field, String termStr) throws ParseException {
  +    return getFuzzyQuery(field, termStr, fuzzyMinSim);
  +  }
  +
     /**
      * Factory method for generating a query (similar to
      * ({@link #getWildcardQuery}). Called when parser parses
  @@ -702,9 +742,12 @@
            if(fms < 0.0f || fms > 1.0f){
              {if (true) throw new ParseException("Minimum similarity for a FuzzyQuery has to be between 0.0f and 1.0f !");}
            }
  -         q = getFuzzyQuery(field, termImage, fms);
  +         if(fms == fuzzyMinSim)
  +           q = getFuzzyQuery(field, termImage);
  +         else
  +           q = getFuzzyQuery(field, termImage, fms);
          } else {
  -         q = getFieldQuery(field, termImage);
  +         q = getFieldQuery(field, analyzer, termImage);
          }
         break;
       case RANGEIN_START:
  @@ -761,7 +804,7 @@
         } else {
           goop2.image = discardEscapeChar(goop2.image);
         }
  -          q = getRangeQuery(field, goop1.image, goop2.image, true);
  +          q = getRangeQuery(field, analyzer, goop1.image, goop2.image, true);
         break;
       case RANGEEX_START:
         jj_consume_token(RANGEEX_START);
  @@ -818,7 +861,7 @@
           goop2.image = discardEscapeChar(goop2.image);
         }
   
  -          q = getRangeQuery(field, goop1.image, goop2.image, false);
  +          q = getRangeQuery(field, analyzer, goop1.image, goop2.image, false);
         break;
       case QUOTED:
         term = jj_consume_token(QUOTED);
  @@ -847,7 +890,7 @@
              }
              catch (Exception ignored) { }
            }
  -         q = getFieldQuery(field, term.image.substring(1, term.image.length()-1), s);
  +         q = getFieldQuery(field, analyzer, term.image.substring(1, term.image.length()-1), s);
         break;
       default:
         jj_la1[21] = jj_gen;
  
  
  
  1.43.2.2  +48 -5     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.43.2.1
  retrieving revision 1.43.2.2
  diff -u -r1.43.2.1 -r1.43.2.2
  --- QueryParser.jj	1 Oct 2004 09:59:23 -0000	1.43.2.1
  +++ QueryParser.jj	11 Oct 2004 13:36:14 -0000	1.43.2.2
  @@ -265,6 +265,16 @@
       }
       clauses.addElement(new BooleanClause(q, required, prohibited));
     }
  +  
  +  /**
  +   * Parameter analyzer is ignored.
  +   * @deprecated use {@link #getFieldQuery(String, String)}
  +   */
  +  protected Query getFieldQuery(String field, 
  +                                                    Analyzer analyzer, 
  +                                                    String queryText)  throws ParseException {
  +    return getFieldQuery(field, queryText);
  +  }
   
     /**
      * @exception ParseException throw in overridden method to disallow
  @@ -309,6 +319,17 @@
         return q;
       }
     }
  +  
  +  /**
  +   * Parameter analyzer is ignored.
  +   * @deprecated use {@link #getFieldQuery(String, String, int)}
  +   */
  +  protected Query getFieldQuery(String field, 
  +                                                    Analyzer analyzer, 
  +                                                    String queryText, 
  +                                                    int slop) throws ParseException {
  +    return getFieldQuery(field, queryText, slop);
  +  }
   
     /**
      * Base implementation delegates to {@link #getFieldQuery(String,String)}.
  @@ -327,6 +348,18 @@
   
       return query;
     }
  +  
  +  /**
  +   * Parameter analyzer is ignored.
  +   * @deprecated use {@link #getRangeQuery(String, String, String, boolean)}
  +   */
  +  protected Query getRangeQuery(String field,
  +      Analyzer analyzer,
  +      String part1,
  +      String part2,
  +      boolean inclusive) throws ParseException {
  +    return getRangeQuery(field, part1, part2, inclusive);
  +  }
   
     /**
      * @exception ParseException throw in overridden method to disallow
  @@ -435,6 +468,13 @@
       return new PrefixQuery(t);
     }
   
  + /**
  +   * @deprecated use {@link #getFuzzyQuery(String, String, float)}
  +   */
  +  protected Query getFuzzyQuery(String field, String termStr) throws ParseException {
  +    return getFuzzyQuery(field, termStr, fuzzyMinSim);
  +  }
  +
     /**
      * Factory method for generating a query (similar to
      * ({@link #getWildcardQuery}). Called when parser parses
  @@ -680,9 +720,12 @@
          	 if(fms < 0.0f || fms > 1.0f){
          	   throw new ParseException("Minimum similarity for a FuzzyQuery has to be between 0.0f and 1.0f !");
          	 }
  -         q = getFuzzyQuery(field, termImage, fms);
  +       	 if(fms == fuzzyMinSim)
  +       	   q = getFuzzyQuery(field, termImage);
  +       	 else
  +           q = getFuzzyQuery(field, termImage, fms);
          } else {
  -         q = getFieldQuery(field, termImage);
  +         q = getFieldQuery(field, analyzer, termImage);
          }
        }
        | ( <RANGEIN_START> ( goop1=<RANGEIN_GOOP>|goop1=<RANGEIN_QUOTED> )
  @@ -700,7 +743,7 @@
         } else {
           goop2.image = discardEscapeChar(goop2.image);
         }
  -          q = getRangeQuery(field, goop1.image, goop2.image, true);
  +          q = getRangeQuery(field, analyzer, goop1.image, goop2.image, true);
           }
        | ( <RANGEEX_START> ( goop1=<RANGEEX_GOOP>|goop1=<RANGEEX_QUOTED> )
            [ <RANGEEX_TO> ] ( goop2=<RANGEEX_GOOP>|goop2=<RANGEEX_QUOTED> )
  @@ -718,7 +761,7 @@
           goop2.image = discardEscapeChar(goop2.image);
         }
   
  -          q = getRangeQuery(field, goop1.image, goop2.image, false);
  +          q = getRangeQuery(field, analyzer, goop1.image, goop2.image, false);
           }
        | term=<QUOTED>
          [ fuzzySlop=<FUZZY_SLOP> ]
  @@ -732,7 +775,7 @@
              }
              catch (Exception ignored) { }
            }
  -         q = getFieldQuery(field, term.image.substring(1, term.image.length()-1), s);
  +         q = getFieldQuery(field, analyzer, term.image.substring(1, term.image.length()-1), s);
          }
     )
     {
  
  
  

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


Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/queryParser QueryParser.java QueryParser.jj

Posted by Christoph Goller <go...@detego-software.de>.
Doug Cutting schrieb:
> goller@apache.org wrote:
> 
>> goller      2004/10/11 06:36:14
>>
>>   Modified:    src/java/org/apache/lucene/queryParser Tag: 
>> lucene_1_4_2_dev
>>                         QueryParser.java QueryParser.jj
> 
> 
> [ ... ]
> 
>>   +   * @deprecated use {@link #getFieldQuery(String, String)}
> 
> 
> Should these be deprecated in 1.4.3?  I don't think so.  They should be 
> deprecated in 1.9 and removed in 2.0, but 1.4.3 should not require 
> application changes if possible when upgrading from earlier 1.x releases.
> 
> Doug

They don't have to be deprecated in 1.4.3. I would even agree to remove the
new methods (those without the analyzer parameter). However there is Daniels
argument that somebody might already have started using them.

So should we leave both method-types (with and without analyze parameter)
without deprecated property side by side? People then might wonder which
one to use/overwrite.

Christoph

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


Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/queryParser QueryParser.java QueryParser.jj

Posted by Christoph Goller <go...@detego-software.de>.
Doug Cutting schrieb:
> goller@apache.org wrote:
> 
>> goller      2004/10/11 06:36:14
>>
>>   Modified:    src/java/org/apache/lucene/queryParser Tag: 
>> lucene_1_4_2_dev
>>                         QueryParser.java QueryParser.jj
> 
> 
> [ ... ]
> 
>>   +   * @deprecated use {@link #getFieldQuery(String, String)}
> 
> 
> Should these be deprecated in 1.4.3?  I don't think so.  They should be 
> deprecated in 1.9 and removed in 2.0, but 1.4.3 should not require 
> application changes if possible when upgrading from earlier 1.x releases.

I removed the deprecated and added proper comments that hopefully avoid
confusion. For the CVS-head I will commit the deprecated version.

Christoph

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


Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/queryParser QueryParser.java QueryParser.jj

Posted by Doug Cutting <cu...@apache.org>.
goller@apache.org wrote:
> goller      2004/10/11 06:36:14
> 
>   Modified:    src/java/org/apache/lucene/queryParser Tag: lucene_1_4_2_dev
>                         QueryParser.java QueryParser.jj

[ ... ]

>   +   * @deprecated use {@link #getFieldQuery(String, String)}

Should these be deprecated in 1.4.3?  I don't think so.  They should be 
deprecated in 1.9 and removed in 2.0, but 1.4.3 should not require 
application changes if possible when upgrading from earlier 1.x releases.

Doug

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