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/search FilteredQuery.java
Date Tue, 11 May 2004 17:52:24 GMT
cutting     2004/05/11 10:52:24

  Modified:    src/java/org/apache/lucene/search FilteredQuery.java
  Log:
  Fix FilteredQuery to support rewritten queries.
  
  Revision  Changes    Path
  1.4       +14 -2     jakarta-lucene/src/java/org/apache/lucene/search/FilteredQuery.java
  
  Index: FilteredQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/FilteredQuery.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FilteredQuery.java	8 May 2004 19:54:12 -0000	1.3
  +++ FilteredQuery.java	11 May 2004 17:52:24 -0000	1.4
  @@ -100,6 +100,18 @@
       };
     }
   
  +  /** Rewrites the wrapped query. */
  +  public Query rewrite(IndexReader reader) throws IOException {
  +    Query rewritten = query.rewrite(reader);
  +    if (rewritten != query) {
  +      FilteredQuery clone = (FilteredQuery)this.clone();
  +      clone.query = rewritten;
  +      return clone;
  +    } else {
  +      return this;
  +    }
  +  }
  +
     /** Prints a user-readable version of this query. */
     public String toString (String s) {
       return "filtered("+query.toString(s)+")->"+filter;
  @@ -118,4 +130,4 @@
     public int hashCode() {
       return query.hashCode() ^ filter.hashCode();
     }
  -}
  \ No newline at end of file
  +}
  
  
  

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


Mime
View raw message