lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r824175 - in /lucene/java/trunk: ./ contrib/collation/src/test/org/apache/lucene/collation/ contrib/highlighter/src/test/org/apache/lucene/search/highlight/ contrib/misc/src/java/org/apache/lucene/queryParser/precedence/ contrib/misc/src/te...
Date Sun, 11 Oct 2009 21:29:07 GMT
Author: uschindler
Date: Sun Oct 11 21:29:07 2009
New Revision: 824175

URL: http://svn.apache.org/viewvc?rev=824175&view=rev
Log:
LUCENE-1971: Remove RangeQuery & Co.

Removed:
    lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreRangeQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/RangeFilter.java
    lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java
Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/common-build.xml
    lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/CollationTestBase.java
    lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java
    lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyFilter.java
    lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java
    lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java
    lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
    lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java
    lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj
    lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParserTokenManager.java
    lucene/java/trunk/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sun Oct 11 21:29:07 2009
@@ -50,6 +50,9 @@
 * LUCENE-1753: Make not yet final TokenStreams final to enforce 
   decorator pattern. (Uwe Schindler)
 
+* LUCENE-1971: Remove deprecated RangeQuery, RangeFilter and
+  ConstantScoreRangeQuery. (Uwe Schindler)
+
 Bug fixes
 
 * LUCENE-1951: When the text provided to WildcardQuery has no wildcard

Modified: lucene/java/trunk/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/common-build.xml?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/common-build.xml (original)
+++ lucene/java/trunk/common-build.xml Sun Oct 11 21:29:07 2009
@@ -42,7 +42,7 @@
   <property name="Name" value="Lucene"/>
   <property name="dev.version" value="3.0-dev"/>
   <property name="version" value="${dev.version}"/>
-  <property name="compatibility.tag" value="lucene_2_9_back_compat_tests_20091010"/>
+  <property name="compatibility.tag" value="lucene_2_9_back_compat_tests_20091011"/>
   <property name="spec.version" value="${version}"/>	
   <property name="year" value="2000-${current.year}"/>
   <property name="final.name" value="lucene-${name}-${version}"/>

Modified: lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/CollationTestBase.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/CollationTestBase.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/CollationTestBase.java
(original)
+++ lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/CollationTestBase.java
Sun Oct 11 21:29:07 2009
@@ -32,7 +32,6 @@
 import org.apache.lucene.search.TermRangeFilter;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TermRangeQuery;
-import org.apache.lucene.search.ConstantScoreRangeQuery;
 import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
@@ -89,11 +88,11 @@
 
     // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
     // orders the U+0698 character before the U+0633 character, so the single
-    // index Term below should NOT be returned by a ConstantScoreRangeQuery
+    // index Term below should NOT be returned by a TermRangeQuery
     // with a Farsi Collator (or an Arabic one for the case when Farsi is not
     // supported).
       
-    // Test ConstantScoreRangeQuery
+    // Test TermRangeQuery
     aqp.setUseOldRangeQuery(false);
     ScoreDoc[] result
       = is.search(aqp.parse("[ \u062F TO \u0698 ]"), null, 1000).scoreDocs;
@@ -174,7 +173,7 @@
     searcher.close();
   }
 
-  public void testFarsiConstantScoreRangeQuery
+  public void testFarsiTermRangeQuery
     (Analyzer analyzer, String firstBeg, String firstEnd, 
      String secondBeg, String secondEnd) throws Exception {
 
@@ -194,15 +193,15 @@
         
     // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
     // orders the U+0698 character before the U+0633 character, so the single
-    // index Term below should NOT be returned by a ConstantScoreRangeQuery
+    // index Term below should NOT be returned by a TermRangeQuery
     // with a Farsi Collator (or an Arabic one for the case when Farsi is 
     // not supported).
     Query csrq 
-      = new ConstantScoreRangeQuery("content", firstBeg, firstEnd, true, true);
+      = new TermRangeQuery("content", firstBeg, firstEnd, true, true);
     ScoreDoc[] result = search.search(csrq, null, 1000).scoreDocs;
     assertEquals("The index Term should not be included.", 0, result.length);
 
-    csrq = new ConstantScoreRangeQuery
+    csrq = new TermRangeQuery
       ("content", secondBeg, secondEnd, true, true);
     result = search.search(csrq, null, 1000).scoreDocs;
     assertEquals("The index Term should be included.", 1, result.length);

Modified: lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java
Sun Oct 11 21:29:07 2009
@@ -58,8 +58,8 @@
        secondRangeBeginning, secondRangeEnd);
   }
 
-  public void testFarsiConstantScoreRangeQuery() throws Exception {
-    testFarsiConstantScoreRangeQuery
+  public void testFarsiTermRangeQuery() throws Exception {
+    testFarsiTermRangeQuery
       (analyzer, firstRangeBeginning, firstRangeEnd, 
        secondRangeBeginning, secondRangeEnd);
   }

Modified: lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyFilter.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyFilter.java
(original)
+++ lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyFilter.java
Sun Oct 11 21:29:07 2009
@@ -76,8 +76,8 @@
        secondRangeBeginning, secondRangeEnd);
   }
 
-  public void testFarsiConstantScoreRangeQuery() throws Exception {
-    testFarsiConstantScoreRangeQuery
+  public void testFarsiTermRangeQuery() throws Exception {
+    testFarsiTermRangeQuery
       (analyzer, firstRangeBeginning, firstRangeEnd, 
        secondRangeBeginning, secondRangeEnd);
   }

Modified: lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java
Sun Oct 11 21:29:07 2009
@@ -53,8 +53,8 @@
                                  secondRangeBeginning, secondRangeEnd);
   }
 
-  public void testFarsiConstantScoreRangeQuery() throws Exception {
-    testFarsiConstantScoreRangeQuery
+  public void testFarsiTermRangeQuery() throws Exception {
+    testFarsiTermRangeQuery
       (analyzer, firstRangeBeginning, firstRangeEnd, 
        secondRangeBeginning, secondRangeEnd);
   }

Modified: lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java
(original)
+++ lucene/java/trunk/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java
Sun Oct 11 21:29:07 2009
@@ -71,8 +71,8 @@
                                  secondRangeBeginning, secondRangeEnd);
   }
 
-  public void testFarsiConstantScoreRangeQuery() throws Exception {
-    testFarsiConstantScoreRangeQuery
+  public void testFarsiTermRangeQuery() throws Exception {
+    testFarsiTermRangeQuery
       (analyzer, firstRangeBeginning, firstRangeEnd, 
        secondRangeBeginning, secondRangeEnd);
   }

Modified: lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
(original)
+++ lucene/java/trunk/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
Sun Oct 11 21:29:07 2009
@@ -55,7 +55,6 @@
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.queryParser.QueryParser;
 import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.ConstantScoreRangeQuery;
 import org.apache.lucene.search.FilteredQuery;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MultiPhraseQuery;
@@ -557,42 +556,6 @@
     helper.start();
   }
 
-  public void testGetConstantScoreRangeFragments() throws Exception {
-
-    numHighlights = 0;
-
-    query = new ConstantScoreRangeQuery(FIELD_NAME, "kannedy", "kznnedy", true, true);
-
-    searcher = new IndexSearcher(ramDir, true);
-    // can't rewrite ConstantScoreRangeQuery if you want to highlight it -
-    // it rewrites to ConstantScoreQuery which cannot be highlighted
-    // query = unReWrittenQuery.rewrite(reader);
-    System.out.println("Searching for: " + query.toString(FIELD_NAME));
-    hits = searcher.search(query, null, 1000);
-
-    for (int i = 0; i < hits.totalHits; i++) {
-      String text = searcher.doc(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
-      int maxNumFragmentsRequired = 2;
-      String fragmentSeparator = "...";
-      QueryScorer scorer = null;
-      TokenStream tokenStream = null;
-
-      tokenStream = analyzer.tokenStream(HighlighterTest.FIELD_NAME, new StringReader(text));
-      
-      scorer = new QueryScorer(query, HighlighterTest.FIELD_NAME);
-
-      Highlighter highlighter = new Highlighter(this, scorer);
-
-      highlighter.setTextFragmenter(new SimpleFragmenter(20));
-
-      String result = highlighter.getBestFragments(tokenStream, text, maxNumFragmentsRequired,
-          fragmentSeparator);
-      System.out.println("\t" + result);
-    }
-    assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
-        numHighlights == 5);
-  }
-  
   public void testConstantScoreMultiTermQuery() throws Exception {
 
     numHighlights = 0;

Modified: lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java
(original)
+++ lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java
Sun Oct 11 21:29:07 2009
@@ -22,7 +22,7 @@
 import org.apache.lucene.search.PhraseQuery;
 import org.apache.lucene.search.PrefixQuery;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.RangeQuery;
+import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.WildcardQuery;
 import org.apache.lucene.util.Parameter;
@@ -428,9 +428,7 @@
     }
     catch (Exception e) { }
 
-    return new RangeQuery(new Term(field, part1),
-                          new Term(field, part2),
-                          inclusive);
+    return new TermRangeQuery(field, part1, part2, inclusive, inclusive);
   }
 
   /**

Modified: lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj
(original)
+++ lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj
Sun Oct 11 21:29:07 2009
@@ -46,7 +46,7 @@
 import org.apache.lucene.search.PhraseQuery;
 import org.apache.lucene.search.PrefixQuery;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.RangeQuery;
+import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.WildcardQuery;
 import org.apache.lucene.util.Parameter;
@@ -452,9 +452,7 @@
     }
     catch (Exception e) { }
 
-    return new RangeQuery(new Term(field, part1),
-                          new Term(field, part2),
-                          inclusive);
+    return new TermRangeQuery(field, part1, part2, inclusive, inclusive);
   }
 
   /**

Modified: lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParserTokenManager.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParserTokenManager.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParserTokenManager.java
(original)
+++ lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParserTokenManager.java
Sun Oct 11 21:29:07 2009
@@ -20,7 +20,7 @@
 import org.apache.lucene.search.PhraseQuery;
 import org.apache.lucene.search.PrefixQuery;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.RangeQuery;
+import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.WildcardQuery;
 import org.apache.lucene.util.Parameter;

Modified: lucene/java/trunk/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java
(original)
+++ lucene/java/trunk/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java
Sun Oct 11 21:29:07 2009
@@ -32,7 +32,7 @@
 import org.apache.lucene.search.PhraseQuery;
 import org.apache.lucene.search.PrefixQuery;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.RangeQuery;
+import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.WildcardQuery;
 import org.apache.lucene.util.LocalizedTestCase;
@@ -359,7 +359,7 @@
 
   public void testRange() throws Exception {
     assertQueryEquals("[ a TO z]", null, "[a TO z]");
-    assertTrue(getQuery("[ a TO z]", null) instanceof RangeQuery);
+    assertTrue(getQuery("[ a TO z]", null) instanceof TermRangeQuery);
     assertQueryEquals("[ a TO z ]", null, "[a TO z]");
     assertQueryEquals("{ a TO z}", null, "{a TO z}");
     assertQueryEquals("{ a TO z }", null, "{a TO z}");

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java?rev=824175&r1=824174&r2=824175&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java Sun Oct 11
21:29:07 2009
@@ -66,23 +66,6 @@
     searcher.close();
   }
   
-  //TODO: remove in Lucene 3.0
-  public void testDeprecatedCstrctors() throws IOException {
-    Query query = new RangeQuery(null, new Term("content","C"), false);
-    initializeIndex(new String[] {"A", "B", "C", "D"});
-    IndexSearcher searcher = new IndexSearcher(dir, true);
-    ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
-    assertEquals("A,B,C,D, only B in range", 2, hits.length);
-    searcher.close();
-    
-    query = new RangeQuery(new Term("content","C"),null, false);
-    initializeIndex(new String[] {"A", "B", "C", "D"});
-    searcher = new IndexSearcher(dir, true);
-    hits = searcher.search(query, null, 1000).scoreDocs;
-    assertEquals("A,B,C,D, only B in range", 1, hits.length);
-    searcher.close();
-  }
-
   public void testInclusive() throws Exception {
     Query query = new TermRangeQuery("content", "A", "C", true, true);
 



Mime
View raw message