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 BooleanQuery.java
Date Tue, 25 Nov 2003 21:16:36 GMT
cutting     2003/11/25 13:16:36

  Modified:    src/java/org/apache/lucene/search BooleanQuery.java
  Log:
  Optimize patch of yesterday: only clone when needed.
  
  Revision  Changes    Path
  1.17      +6 -2      jakarta-lucene/src/java/org/apache/lucene/search/BooleanQuery.java
  
  Index: BooleanQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/BooleanQuery.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- BooleanQuery.java	25 Nov 2003 00:21:20 -0000	1.16
  +++ BooleanQuery.java	25 Nov 2003 21:16:36 -0000	1.17
  @@ -225,11 +225,15 @@
       if (clauses.size() == 1) {                    // optimize 1-clause queries
         BooleanClause c = (BooleanClause)clauses.elementAt(0);
         if (!c.prohibited) {			  // just return clause
  +
           Query query = c.query.rewrite(reader);    // rewrite first
  -        if (getBoost() != 1.0f) {                 // have to clone to boost
  -          query = (Query)query.clone();
  +
  +        if (getBoost() != 1.0f) {                 // incorporate boost
  +          if (query == c.query)                   // if rewrite was no-op
  +            query = (Query)query.clone();         // then clone before boost
             query.setBoost(getBoost() * query.getBoost());
           }
  +
           return query;
         }
       }
  
  
  

---------------------------------------------------------------------
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