lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r928091 - in /lucene/java/branches/flex_1458/src: java/org/apache/lucene/search/ test/org/apache/lucene/search/
Date Fri, 26 Mar 2010 22:54:12 GMT
Author: uschindler
Date: Fri Mar 26 22:54:11 2010
New Revision: 928091

URL: http://svn.apache.org/viewvc?rev=928091&view=rev
Log:
Fix bug in MTQ backwards layer with WildCardQuery: Wildcard overrides only old method and
so MTQ backwards layer "thinks" that WildCard is legacy. Added assert for all core MTQs.

Modified:
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/WildcardQuery.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestAutomatonQuery.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFuzzyQuery.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPrefixQuery.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestRegexpQuery.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestWildcard.java

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/WildcardQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/WildcardQuery.java?rev=928091&r1=928090&r2=928091&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/WildcardQuery.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/WildcardQuery.java Fri
Mar 26 22:54:11 2010
@@ -19,6 +19,7 @@ package org.apache.lucene.search;
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.util.ToStringUtils;
 import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicAutomata;
@@ -84,6 +85,12 @@ public class WildcardQuery extends Autom
     return new WildcardTermEnum(reader, term);
   }
   
+  // we override this method, else backwards layer in MTQ will prefer getEnum!
+  @Override
+  protected TermsEnum getTermsEnum(IndexReader reader) throws IOException {
+    return super.getTermsEnum(reader);
+  }
+
   /**
    * Returns the pattern term.
    */

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestAutomatonQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestAutomatonQuery.java?rev=928091&r1=928090&r2=928091&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestAutomatonQuery.java
(original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestAutomatonQuery.java
Fri Mar 26 22:54:11 2010
@@ -222,4 +222,10 @@ public class TestAutomatonQuery extends 
     assertSame(TermsEnum.EMPTY, aq.getTermsEnum(searcher.getIndexReader()));
     assertEquals(0, automatonQueryNrHits(aq));
   }
+  
+  @Deprecated
+  public void testBackwardsLayer() {
+    assertTrue(new AutomatonQuery(newTerm("bogus"), BasicAutomata
+        .makeString("piece")).hasNewAPI);
+  }
 }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFuzzyQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFuzzyQuery.java?rev=928091&r1=928090&r2=928091&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFuzzyQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFuzzyQuery.java Fri
Mar 26 22:54:11 2010
@@ -378,5 +378,10 @@ public class TestFuzzyQuery extends Luce
     doc.add(new Field("field", text, Field.Store.YES, Field.Index.ANALYZED));
     writer.addDocument(doc);
   }
+  
+  @Deprecated
+  public void testBackwardsLayer() {
+    assertTrue(new FuzzyQuery(new Term("dummy", "dummy")).hasNewAPI);
+  }
 
 }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=928091&r1=928090&r2=928091&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
(original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
Fri Mar 26 22:54:11 2010
@@ -583,4 +583,9 @@ public class TestNumericRangeQuery64 ext
      // difference to int range is tested in TestNumericRangeQuery32
   }
   
+  @Test @Deprecated
+  public void testBackwardsLayer() {
+    assertTrue(NumericRangeQuery.newLongRange("dummy", null, null, true, true).hasNewAPI);
+  }
+  
 }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPrefixQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPrefixQuery.java?rev=928091&r1=928090&r2=928091&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPrefixQuery.java
(original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPrefixQuery.java
Fri Mar 26 22:54:11 2010
@@ -59,4 +59,9 @@ public class TestPrefixQuery extends Luc
     hits = searcher.search(query, null, 1000).scoreDocs;
     assertEquals("everything", 3, hits.length);
   }
+  
+  @Deprecated
+  public void testBackwardsLayer() {
+    assertTrue(new PrefixQuery(new Term("dummy", "dummy")).hasNewAPI);
+  }
 }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestRegexpQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestRegexpQuery.java?rev=928091&r1=928090&r2=928091&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestRegexpQuery.java
(original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestRegexpQuery.java
Fri Mar 26 22:54:11 2010
@@ -120,4 +120,9 @@ public class TestRegexpQuery extends Luc
   public void testBacktracking() throws IOException {
     assertEquals(1, regexQueryNrHits("4934[314]"));
   }
+  
+  @Deprecated
+  public void testBackwardsLayer() {
+    assertTrue(new RegexpQuery(newTerm(".*")).hasNewAPI);
+  }
 }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java?rev=928091&r1=928090&r2=928091&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java
(original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java
Fri Mar 26 22:54:11 2010
@@ -413,4 +413,9 @@ public class TestTermRangeQuery extends 
     //assertEquals("C added => A,B,<empty string>,C in range", 3, hits.length());
      searcher.close();
   }
+  
+  @Deprecated
+  public void testBackwardsLayer() {
+    assertTrue(new TermRangeQuery("dummy", null, null, true, true).hasNewAPI);
+  }
 }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestWildcard.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestWildcard.java?rev=928091&r1=928090&r2=928091&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestWildcard.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestWildcard.java Fri
Mar 26 22:54:11 2010
@@ -361,4 +361,10 @@ public class TestWildcard
     assertMatches(searcher, new OldWildcardQuery(new Term("body", "*tal")), 1);
     assertMatches(searcher, new OldWildcardQuery(new Term("body", "*tal*")), 2);
   }
+  
+  @Deprecated
+  public void testBackwardsLayer() {
+    assertTrue(new WildcardQuery(new Term("body", "metal*")).hasNewAPI);
+    assertFalse(new OldWildcardQuery(new Term("body", "metal*")).hasNewAPI);
+  }
 }



Mime
View raw message