lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r794328 - in /lucene/solr/trunk: ./ example/solr/conf/ lib/ src/java/org/apache/solr/analysis/ src/java/org/apache/solr/core/ src/java/org/apache/solr/handler/component/ src/java/org/apache/solr/request/ src/java/org/apache/solr/schema/ src...
Date Wed, 15 Jul 2009 17:21:06 GMT
Author: shalin
Date: Wed Jul 15 17:21:04 2009
New Revision: 794328

URL: http://svn.apache.org/viewvc?rev=794328&view=rev
Log:
Upgraded to Lucene 2.9-dev r794238.

Other changes include:
    LUCENE-1614 - Use Lucene's DocIdSetIterator.NO_MORE_DOCS as the sentinel value.
    LUCENE-1630 - Add acceptsDocsOutOfOrder method to Collector implementations.
    LUCENE-1673, LUCENE-1701 - Trie has moved to Lucene core and renamed to NumericRangeQuery.
    LUCENE-1662, LUCENE-1687 - Replace usage of ExtendedFieldCache by FieldCache.

SOLR-1241: Solr's CharFilter has been moved to Lucene. Remove CharFilter and related classes
from Solr and use Lucene's corresponding code.

SOLR-1261: Lucene trunk renamed RangeQuery & Co to TermRangeQuery.

Added:
    lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java   (with
props)
Removed:
    lucene/solr/trunk/src/java/org/apache/solr/analysis/BaseCharFilter.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharFilter.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharReader.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharStream.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharStreamAwareCJKTokenizer.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharStreamAwareCJKTokenizerFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharStreamAwareCharTokenizer.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharStreamAwareWhitespaceTokenizer.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharStreamAwareWhitespaceTokenizerFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/MappingCharFilter.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/NormalizeMap.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieIndexTokenizerFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieQueryTokenizerFactory.java
    lucene/solr/trunk/src/test/org/apache/solr/analysis/TestCharFilter.java
    lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMappingCharFilter.java
Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/example/solr/conf/schema.xml
    lucene/solr/trunk/lib/lucene-analyzers-2.9-dev.jar
    lucene/solr/trunk/lib/lucene-core-2.9-dev.jar
    lucene/solr/trunk/lib/lucene-highlighter-2.9-dev.jar
    lucene/solr/trunk/lib/lucene-memory-2.9-dev.jar
    lucene/solr/trunk/lib/lucene-misc-2.9-dev.jar
    lucene/solr/trunk/lib/lucene-queries-2.9-dev.jar
    lucene/solr/trunk/lib/lucene-snowball-2.9-dev.jar
    lucene/solr/trunk/lib/lucene-spellchecker-2.9-dev.jar
    lucene/solr/trunk/src/java/org/apache/solr/analysis/CharFilterFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/MappingCharFilterFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/TokenizerChain.java
    lucene/solr/trunk/src/java/org/apache/solr/core/StandardDirectoryFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
    lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java
    lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java
    lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java
    lucene/solr/trunk/src/java/org/apache/solr/search/BitDocSet.java
    lucene/solr/trunk/src/java/org/apache/solr/search/DocSetHitCollector.java
    lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java
    lucene/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java
    lucene/solr/trunk/src/java/org/apache/solr/search/function/DoubleFieldSource.java
    lucene/solr/trunk/src/java/org/apache/solr/search/function/FieldCacheSource.java
    lucene/solr/trunk/src/java/org/apache/solr/search/function/LongFieldSource.java
    lucene/solr/trunk/src/java/org/apache/solr/search/function/StringIndexDocValues.java
    lucene/solr/trunk/src/test/org/apache/solr/util/TestOpenBitSet.java
    lucene/solr/trunk/src/webapp/web/admin/analysis.jsp

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Wed Jul 15 17:21:04 2009
@@ -552,6 +552,17 @@
     hitting "/admin/logging.jsp" should switch to "/admin/logging".
     (hossman)
 
+42. Upgraded to Lucene 2.9-dev r794238. Other changes include:
+    LUCENE-1614 - Use Lucene's DocIdSetIterator.NO_MORE_DOCS as the sentinel value.
+    LUCENE-1630 - Add acceptsDocsOutOfOrder method to Collector implementations.
+    LUCENE-1673, LUCENE-1701 - Trie has moved to Lucene core and renamed to NumericRangeQuery.
+    LUCENE-1662, LUCENE-1687 - Replace usage of ExtendedFieldCache by FieldCache.
+    (shalin)
+
+42. SOLR-1241: Solr's CharFilter has been moved to Lucene. Remove CharFilter and related
classes
+    from Solr and use Lucene's corresponding code (koji via shalin)
+
+43. SOLR-1261: Lucene trunk renamed RangeQuery & Co to TermRangeQuery (Uwe Schindler
via shalin)
 
 Build
 ----------------------

Modified: lucene/solr/trunk/example/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/schema.xml?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/example/solr/conf/schema.xml (original)
+++ lucene/solr/trunk/example/solr/conf/schema.xml Wed Jul 15 17:21:04 2009
@@ -252,12 +252,12 @@
       </analyzer>
     </fieldType>
 
-    <!-- charFilter + "CharStream aware" WhitespaceTokenizer  -->
+    <!-- charFilter + WhitespaceTokenizer  -->
     <!--
     <fieldType name="textCharNorm" class="solr.TextField" positionIncrementGap="100" >
       <analyzer>
         <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
-        <tokenizer class="solr.CharStreamAwareWhitespaceTokenizerFactory"/>
+        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
       </analyzer>
     </fieldType>
     -->
@@ -347,7 +347,7 @@
    <!-- "default" values can be specified for fields, indicating which
         value should be used if no value is specified when adding a document.
      -->
-   <field name="popularity" type="sint" indexed="true" stored="true" default="0"/>
+   <field name="popularity" type="sint" indexed="true" stored="true"/>
    <field name="inStock" type="boolean" indexed="true" stored="true"/>
 
    <!-- Some sample docs exists solely to demonstrate the spellchecker

Modified: lucene/solr/trunk/lib/lucene-analyzers-2.9-dev.jar
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/lib/lucene-analyzers-2.9-dev.jar?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/solr/trunk/lib/lucene-core-2.9-dev.jar
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/lib/lucene-core-2.9-dev.jar?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/solr/trunk/lib/lucene-highlighter-2.9-dev.jar
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/lib/lucene-highlighter-2.9-dev.jar?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/solr/trunk/lib/lucene-memory-2.9-dev.jar
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/lib/lucene-memory-2.9-dev.jar?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/solr/trunk/lib/lucene-misc-2.9-dev.jar
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/lib/lucene-misc-2.9-dev.jar?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/solr/trunk/lib/lucene-queries-2.9-dev.jar
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/lib/lucene-queries-2.9-dev.jar?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/solr/trunk/lib/lucene-snowball-2.9-dev.jar
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/lib/lucene-snowball-2.9-dev.jar?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/solr/trunk/lib/lucene-spellchecker-2.9-dev.jar
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/lib/lucene-spellchecker-2.9-dev.jar?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/solr/trunk/src/java/org/apache/solr/analysis/CharFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/analysis/CharFilterFactory.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/analysis/CharFilterFactory.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/analysis/CharFilterFactory.java Wed Jul 15
17:21:04 2009
@@ -19,6 +19,8 @@
 
 import java.util.Map;
 
+import org.apache.lucene.analysis.CharStream;
+
 /**
 *
 * @version $Id$

Modified: lucene/solr/trunk/src/java/org/apache/solr/analysis/MappingCharFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/analysis/MappingCharFilterFactory.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/analysis/MappingCharFilterFactory.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/analysis/MappingCharFilterFactory.java Wed
Jul 15 17:21:04 2009
@@ -24,6 +24,9 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.lucene.analysis.CharStream;
+import org.apache.lucene.analysis.MappingCharFilter;
+import org.apache.lucene.analysis.NormalizeCharMap;
 import org.apache.solr.common.ResourceLoader;
 import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.util.plugin.ResourceLoaderAware;
@@ -37,7 +40,7 @@
 public class MappingCharFilterFactory extends BaseCharFilterFactory implements
     ResourceLoaderAware {
 
-  protected NormalizeMap normMap;
+  protected NormalizeCharMap normMap;
   private String mapping;
 
   public void inform(ResourceLoader loader) {
@@ -62,7 +65,7 @@
       catch( IOException e ){
         throw new RuntimeException( e );
       }
-      normMap = new NormalizeMap();
+      normMap = new NormalizeCharMap();
       parseRules( wlist, normMap );
     }
   }
@@ -73,8 +76,8 @@
 
   // "source" => "target"
   static Pattern p = Pattern.compile( "\"(.*)\"\\s*=>\\s*\"(.*)\"\\s*$" );
-  
-  protected void parseRules( List<String> rules, NormalizeMap normMap ){
+
+  protected void parseRules( List<String> rules, NormalizeCharMap normMap ){
     for( String rule : rules ){
       Matcher m = p.matcher( rule );
       if( !m.find() )

Modified: lucene/solr/trunk/src/java/org/apache/solr/analysis/TokenizerChain.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/analysis/TokenizerChain.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/analysis/TokenizerChain.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/analysis/TokenizerChain.java Wed Jul 15 17:21:04
2009
@@ -18,7 +18,8 @@
 package org.apache.solr.analysis;
 
 import org.apache.lucene.analysis.TokenStream;
-import org.apache.solr.analysis.TokenizerFactory;
+import org.apache.lucene.analysis.CharStream;
+import org.apache.lucene.analysis.CharReader;
 
 import java.io.Reader;
 

Added: lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java?rev=794328&view=auto
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java (added)
+++ lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java Wed Jul
15 17:21:04 2009
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.analysis;
+
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.NumericTokenStream;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.schema.DateField;
+import static org.apache.solr.schema.TrieField.TrieTypes;
+
+import java.io.IOException;
+import java.io.Reader;
+
+/**
+ * Tokenizer for trie fields. It uses NumericTokenStream to create multiple trie encoded
string per number.
+ * Each string created by this tokenizer for a given number differs from the previous by
the given precisionStep.
+ * For query time token streams that only contain the highest precision term, use 32/64 as
precisionStep.
+ * <p/>
+ * Refer to {@link org.apache.lucene.search.NumericRangeQuery} for more details.
+ *
+ * @version $Id$
+ * @see org.apache.lucene.search.NumericRangeQuery
+ * @see org.apache.solr.schema.TrieField
+ * @since solr 1.4
+ */
+public class TrieTokenizerFactory extends BaseTokenizerFactory {
+  protected static final DateField dateField = new DateField();
+  protected final int precisionStep;
+  protected final TrieTypes type;
+
+  public TrieTokenizerFactory(TrieTypes type, int precisionStep) {
+    this.type = type;
+    this.precisionStep = precisionStep;
+  }
+
+  public TokenStream create(Reader input) {
+    try {
+      StringBuilder builder = new StringBuilder();
+      char[] buf = new char[8];
+      int len;
+      while ((len = input.read(buf)) != -1)
+        builder.append(buf, 0, len);
+      switch (type) {
+        case INTEGER:
+          return new NumericTokenStream(precisionStep).setIntValue(Integer.parseInt(builder.toString()));
+        case FLOAT:
+          return new NumericTokenStream(precisionStep).setFloatValue(Float.parseFloat(builder.toString()));
+        case LONG:
+          return new NumericTokenStream(precisionStep).setLongValue(Long.parseLong(builder.toString()));
+        case DOUBLE:
+          return new NumericTokenStream(precisionStep).setDoubleValue(Double.parseDouble(builder.toString()));
+        case DATE:
+          return new NumericTokenStream(precisionStep).setLongValue(dateField.parseMath(null,
builder.toString()).getTime());
+        default:
+          throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for
trie field");
+      }
+    } catch (IOException e) {
+      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unable to create TrieIndexTokenizer",
e);
+    }
+  }
+}

Propchange: lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/solr/trunk/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/StandardDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/StandardDirectoryFactory.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/StandardDirectoryFactory.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/StandardDirectoryFactory.java Wed Jul
15 17:21:04 2009
@@ -21,8 +21,6 @@
 
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.store.NIOFSDirectory;
-import org.apache.lucene.util.Constants;
 
 /**
  * Directory provider which mimics original Solr FSDirectory based behavior.
@@ -31,10 +29,6 @@
 public class StandardDirectoryFactory extends DirectoryFactory {
 
   public Directory open(String path) throws IOException {
-    if (!Constants.WINDOWS) {
-      return new NIOFSDirectory(new File(path), null);
-    }
-
-    return new FSDirectory(new File(path), null);
+    return FSDirectory.open(new File(path));
   }
 }

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java Wed Jul
15 17:21:04 2009
@@ -21,12 +21,11 @@
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.*;
-import org.apache.lucene.search.ExtendedFieldCache.DoubleParser;
-import org.apache.lucene.search.ExtendedFieldCache.LongParser;
+import org.apache.lucene.search.FieldCache.DoubleParser;
+import org.apache.lucene.search.FieldCache.LongParser;
 import org.apache.lucene.search.FieldCache.FloatParser;
 import org.apache.lucene.search.FieldCache.IntParser;
 import org.apache.lucene.search.FieldCache.Parser;
-import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
@@ -45,7 +44,6 @@
 import org.apache.solr.util.SolrPluginUtils;
 
 import java.io.IOException;
-import java.io.Reader;
 import java.net.URL;
 import java.util.*;
 import java.text.Collator;
@@ -615,7 +613,7 @@
   static ScoreDocComparator comparatorLong (final IndexReader reader, final String fieldname,
Parser parser)
   throws IOException {
     final String field = fieldname.intern();
-    final long[] fieldOrder = parser == null ? ExtendedFieldCache.EXT_DEFAULT.getLongs(reader,
field) :  ExtendedFieldCache.EXT_DEFAULT.getLongs(reader, field, (LongParser) parser);
+    final long[] fieldOrder = parser == null ? FieldCache.DEFAULT.getLongs(reader, field)
:  FieldCache.DEFAULT.getLongs(reader, field, (LongParser) parser);
     return new ScoreDocComparator() {
 
       public final int compare (final ScoreDoc i, final ScoreDoc j) {
@@ -680,7 +678,7 @@
   static ScoreDocComparator comparatorDouble(final IndexReader reader, final String fieldname,
Parser parser)
   throws IOException {
     final String field = fieldname.intern();
-    final double[] fieldOrder = parser == null ? ExtendedFieldCache.EXT_DEFAULT.getDoubles(reader,
field) :  ExtendedFieldCache.EXT_DEFAULT.getDoubles(reader, field, (DoubleParser) parser);
+    final double[] fieldOrder = parser == null ? FieldCache.DEFAULT.getDoubles(reader, field)
:  FieldCache.DEFAULT.getDoubles(reader, field, (DoubleParser) parser);
     return new ScoreDocComparator () {
 
       public final int compare (final ScoreDoc i, final ScoreDoc j) {

Modified: lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java Wed Jul 15 17:21:04
2009
@@ -309,7 +309,7 @@
     throws IOException {
 
     DocSet hasVal = searcher.getDocSet
-      (new ConstantScoreRangeQuery(fieldName, null, null, false, false));
+      (new TermRangeQuery(fieldName, null, null, false, false));
     return docs.andNotSize(hasVal);
   }
 
@@ -665,14 +665,13 @@
   }
 
   /**
-   * Macro for getting the numDocs of a ConstantScoreRangeQuery over docs
+   * Macro for getting the numDocs of a TermRangeQuery over docs
    * @see SolrIndexSearcher#numDocs
-   * @see ConstantScoreRangeQuery
+   * @see TermRangeQuery
    */
   protected int rangeCount(String field, String low, String high,
                            boolean iLow, boolean iHigh) throws IOException {
-    return searcher.numDocs(new ConstantScoreRangeQuery(field,low,high,
-                                                        iLow,iHigh),
+    return searcher.numDocs(new TermRangeQuery(field,low,high,iLow,iHigh),
                             base);
   }
   

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java Wed Jul 15 17:21:04 2009
@@ -25,7 +25,7 @@
 import org.apache.lucene.analysis.Token;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.RangeQuery;
+import org.apache.lucene.search.TermRangeQuery;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.OrdFieldSource;
 import org.apache.solr.search.Sorting;
@@ -436,23 +436,22 @@
    * handle nulls in part1 and/or part2 as well as unequal minInclusive and maxInclusive
parameters gracefully.
    *
    * @param parser
-   *@param field        the name of the field
+   * @param field        the name of the field
    * @param part1        the lower boundary of the range, nulls are allowed.
    * @param part2        the upper boundary of the range, nulls are allowed
    * @param minInclusive whether the minimum of the range is inclusive or not
    * @param maxInclusive whether the maximum of the range is inclusive or not
-*      @return a Query instance to perform range search according to given parameters
+*    @return a Query instance to perform range search according to given parameters
    *
    * @see org.apache.solr.search.SolrQueryParser#getRangeQuery(String, String, String, boolean)
    */
   public Query getRangeQuery(QParser parser, String field, String part1, String part2, boolean
minInclusive, boolean maxInclusive) {
-    RangeQuery rangeQuery = new RangeQuery(
+    // constant score mode is now enabled per default
+    return new TermRangeQuery(
             field,
             part1 == null ? null : toInternal(part1),
             part2 == null ? null : toInternal(part2),
             minInclusive, maxInclusive);
-    rangeQuery.setConstantScoreRewrite(true);
-    return rangeQuery;
   }
 
 }

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java Wed Jul 15 17:21:04 2009
@@ -19,9 +19,8 @@
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.SortField;
-import org.apache.lucene.search.trie.IntTrieRangeQuery;
-import org.apache.lucene.search.trie.LongTrieRangeQuery;
-import org.apache.lucene.search.trie.TrieUtils;
+import org.apache.lucene.search.NumericRangeQuery;
+import org.apache.lucene.search.FieldCache;
 import org.apache.solr.analysis.*;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.request.TextResponseWriter;
@@ -33,8 +32,9 @@
 import java.util.Map;
 
 /**
- * Provides field types to support for Lucene's Trie Range Queries. See {@linkplain org.apache.lucene.search.trie
- * package description} for more details. It supports integer, float, long, double and date
types.
+ * Provides field types to support for Lucene's Trie Range Queries.
+ * See {@link org.apache.lucene.search.NumericRangeQuery} for more details.
+ * It supports integer, float, long, double and date types.
  * <p/>
  * For each number being added to this field, multiple terms are generated as per the algorithm
described in the above
  * link. The possible number of terms increases dramatically with higher precision steps
(factor 2^precisionStep). For
@@ -46,7 +46,7 @@
  * generated, range search will be no faster than any other number field, but sorting will
be possible.
  *
  * @version $Id$
- * @see org.apache.lucene.search.trie.TrieUtils
+ * @see org.apache.lucene.search.NumericRangeQuery
  * @since solr 1.4
  */
 public class TrieField extends FieldType {
@@ -78,11 +78,12 @@
                 "Invalid type specified in schema.xml for field: " + args.get("name"), e);
       }
     }
-
+    
     CharFilterFactory[] filterFactories = new CharFilterFactory[0];
     TokenFilterFactory[] tokenFilterFactories = new TokenFilterFactory[0];
-    analyzer = new TokenizerChain(filterFactories, new TrieIndexTokenizerFactory(type, precisionStep),
tokenFilterFactories);
-    queryAnalyzer = new TokenizerChain(filterFactories, new TrieQueryTokenizerFactory(type),
tokenFilterFactories);
+    analyzer = new TokenizerChain(filterFactories, new TrieTokenizerFactory(type, precisionStep),
tokenFilterFactories);
+    // for query time we only need one token, so we use the biggest possible precisionStep:
+    queryAnalyzer = new TokenizerChain(filterFactories, new TrieTokenizerFactory(type, Integer.MAX_VALUE),
tokenFilterFactories);
   }
 
   @Override
@@ -107,12 +108,14 @@
   public SortField getSortField(SchemaField field, boolean top) {
     switch (type) {
       case INTEGER:
+        return new SortField(field.getName(), FieldCache.NUMERIC_UTILS_INT_PARSER, top);
       case FLOAT:
-        return TrieUtils.getIntSortField(field.getName(), top);
+        return new SortField(field.getName(), FieldCache.NUMERIC_UTILS_FLOAT_PARSER, top);
+      case DATE:
       case LONG:
+        return new SortField(field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, top);
       case DOUBLE:
-      case DATE:
-        return TrieUtils.getLongSortField(field.getName(), top);
+        return new SortField(field.getName(), FieldCache.NUMERIC_UTILS_DOUBLE_PARSER, top);
       default:
         throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie
field: " + field.name);
     }
@@ -121,15 +124,14 @@
   public ValueSource getValueSource(SchemaField field) {
     switch (type) {
       case INTEGER:
-        return new IntFieldSource(field.getName(), TrieUtils.FIELD_CACHE_INT_PARSER);
+        return new IntFieldSource(field.getName(), FieldCache.NUMERIC_UTILS_INT_PARSER);
       case FLOAT:
-        return new FloatFieldSource(field.getName(), TrieUtils.FIELD_CACHE_FLOAT_PARSER);
+        return new FloatFieldSource(field.getName(), FieldCache.NUMERIC_UTILS_FLOAT_PARSER);
+      case DATE:
       case LONG:
-        return new LongFieldSource(field.getName(), TrieUtils.FIELD_CACHE_LONG_PARSER);
+        return new LongFieldSource(field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER);
       case DOUBLE:
-        return new DoubleFieldSource(field.getName(), TrieUtils.FIELD_CACHE_DOUBLE_PARSER);
-      case DATE:
-        return new LongFieldSource(field.getName(), TrieUtils.FIELD_CACHE_LONG_PARSER);
+        return new DoubleFieldSource(field.getName(), FieldCache.NUMERIC_UTILS_DOUBLE_PARSER);
       default:
         throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie
field: " + field.name);
     }
@@ -167,31 +169,31 @@
     Query query = null;
     switch (type) {
       case INTEGER:
-        query = new IntTrieRangeQuery(field, precisionStep,
+        query = NumericRangeQuery.newIntRange(field, precisionStep,
                 min == null ? null : Integer.parseInt(min),
                 max == null ? null : Integer.parseInt(max),
                 minInclusive, maxInclusive);
         break;
       case FLOAT:
-        query = new IntTrieRangeQuery(field, precisionStep,
-                min == null ? null : TrieUtils.floatToSortableInt(Float.parseFloat(min)),
-                max == null ? null : TrieUtils.floatToSortableInt(Float.parseFloat(max)),
+        query = NumericRangeQuery.newFloatRange(field, precisionStep,
+                min == null ? null : Float.parseFloat(min),
+                max == null ? null : Float.parseFloat(max),
                 minInclusive, maxInclusive);
         break;
       case LONG:
-        query = new LongTrieRangeQuery(field, precisionStep,
+        query = NumericRangeQuery.newLongRange(field, precisionStep,
                 min == null ? null : Long.parseLong(min),
                 max == null ? null : Long.parseLong(max),
                 minInclusive, maxInclusive);
         break;
       case DOUBLE:
-        query = new LongTrieRangeQuery(field, precisionStep,
-                min == null ? null : TrieUtils.doubleToSortableLong(Double.parseDouble(min)),
-                max == null ? null : TrieUtils.doubleToSortableLong(Double.parseDouble(max)),
+        query = NumericRangeQuery.newDoubleRange(field, precisionStep,
+                min == null ? null : Double.parseDouble(min),
+                max == null ? null : Double.parseDouble(max),
                 minInclusive, maxInclusive);
         break;
       case DATE:
-        query = new LongTrieRangeQuery(field, precisionStep,
+        query = NumericRangeQuery.newLongRange(field, precisionStep,
                 min == null ? null : dateField.parseMath(null, min).getTime(),
                 max == null ? null : dateField.parseMath(null, max).getTime(),
                 minInclusive, maxInclusive);

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/BitDocSet.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/BitDocSet.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/BitDocSet.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/BitDocSet.java Wed Jul 15 17:21:04 2009
@@ -19,6 +19,7 @@
 
 import org.apache.lucene.util.OpenBitSet;
 import org.apache.lucene.util.OpenBitSetIterator;
+import org.apache.lucene.search.DocIdSetIterator;
 
 /**
  * <code>BitDocSet</code> represents an unordered set of Lucene Document Ids
@@ -84,7 +85,7 @@
       private final OpenBitSetIterator iter = new OpenBitSetIterator(bits);
       private int pos = iter.nextDoc();
       public boolean hasNext() {
-        return pos>=0;
+        return pos != DocIdSetIterator.NO_MORE_DOCS;
       }
 
       public Integer next() {

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/DocSetHitCollector.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/DocSetHitCollector.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/DocSetHitCollector.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/DocSetHitCollector.java Wed Jul 15 17:21:04
2009
@@ -84,6 +84,10 @@
   public void setNextReader(IndexReader reader, int docBase) throws IOException {
     this.base = docBase;
   }
+
+  public boolean acceptsDocsOutOfOrder() {
+    return false;
+  }
 }
 
 class DocSetDelegateCollector extends DocSetCollector {
@@ -136,4 +140,4 @@
     collector.setNextReader(reader, docBase);
     this.base = docBase;
   }
-}
\ No newline at end of file
+}

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java Wed Jul 15 17:21:04
2009
@@ -317,13 +317,13 @@
       Term t = q.getTerm();
       FieldType ft = writeFieldName(t.field(), schema, out, flags);
       writeFieldVal(t.text(), ft, out, flags);
-    } else if (query instanceof ConstantScoreRangeQuery) {
-      ConstantScoreRangeQuery q = (ConstantScoreRangeQuery)query;
+    } else if (query instanceof TermRangeQuery) {
+      TermRangeQuery q = (TermRangeQuery)query;
       String fname = q.getField();
       FieldType ft = writeFieldName(fname, schema, out, flags);
       out.append( q.includesLower() ? '[' : '{' );
-      String lt = q.getLowerVal();
-      String ut = q.getUpperVal();
+      String lt = q.getLowerTerm();
+      String ut = q.getUpperTerm();
       if (lt==null) {
         out.append('*');
       } else {
@@ -339,17 +339,17 @@
       }
 
       out.append( q.includesUpper() ? ']' : '}' );
-    } else if (query instanceof RangeQuery) {
-      RangeQuery q = (RangeQuery)query;
+    } else if (query instanceof NumericRangeQuery) {
+      NumericRangeQuery q = (NumericRangeQuery)query;
       String fname = q.getField();
       FieldType ft = writeFieldName(fname, schema, out, flags);
-      out.append( q.isInclusive() ? '[' : '{' );
-      Term lt = q.getLowerTerm();
-      Term ut = q.getUpperTerm();
+      out.append( q.includesMin() ? '[' : '{' );
+      Number lt = q.getMin();
+      Number ut = q.getMax();
       if (lt==null) {
         out.append('*');
       } else {
-        writeFieldVal(lt.text(), ft, out, flags);
+        writeFieldVal(lt.toString(), ft, out, flags);
       }
 
       out.append(" TO ");
@@ -357,11 +357,10 @@
       if (ut==null) {
         out.append('*');
       } else {
-        writeFieldVal(ut.text(), ft, out, flags);
+        writeFieldVal(ut.toString(), ft, out, flags);
       }
 
-      out.append( q.isInclusive() ? ']' : '}' );
-
+      out.append( q.includesMax() ? ']' : '}' );
     } else if (query instanceof BooleanQuery) {
       BooleanQuery q = (BooleanQuery)query;
       boolean needParens=false;

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java Wed Jul 15 17:21:04
2009
@@ -934,6 +934,9 @@
           }
           public void setNextReader(IndexReader reader, int docBase) throws IOException {
           }
+          public boolean acceptsDocsOutOfOrder() {
+            return true;
+          }
         };
       } else {
         collector = new Collector() {
@@ -948,6 +951,9 @@
           }
           public void setNextReader(IndexReader reader, int docBase) throws IOException {
           }
+          public boolean acceptsDocsOutOfOrder() {
+            return true;
+          }
         };
       }
       
@@ -1051,6 +1057,9 @@
            }
            public void setNextReader(IndexReader reader, int docBase) throws IOException
{
            }
+           public boolean acceptsDocsOutOfOrder() {
+             return false;
+           }
          });
        }
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/function/DoubleFieldSource.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/function/DoubleFieldSource.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/function/DoubleFieldSource.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/function/DoubleFieldSource.java Wed
Jul 15 17:21:04 2009
@@ -18,7 +18,7 @@
 package org.apache.solr.search.function;
 
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.search.ExtendedFieldCache;
+import org.apache.lucene.search.FieldCache;
 
 import java.io.IOException;
 
@@ -31,13 +31,13 @@
  */
 
 public class DoubleFieldSource extends FieldCacheSource {
-  protected ExtendedFieldCache.DoubleParser parser;
+  protected FieldCache.DoubleParser parser;
 
   public DoubleFieldSource(String field) {
     this(field, null);
   }
 
-  public DoubleFieldSource(String field, ExtendedFieldCache.DoubleParser parser) {
+  public DoubleFieldSource(String field, FieldCache.DoubleParser parser) {
     super(field);
     this.parser = parser;
   }
@@ -48,8 +48,8 @@
 
   public DocValues getValues(IndexReader reader) throws IOException {
     final double[] arr = (parser == null) ?
-            ((ExtendedFieldCache) cache).getDoubles(reader, field) :
-            ((ExtendedFieldCache) cache).getDoubles(reader, field, parser);
+            ((FieldCache) cache).getDoubles(reader, field) :
+            ((FieldCache) cache).getDoubles(reader, field, parser);
     return new DocValues() {
       public float floatVal(int doc) {
         return (float) arr[doc];
@@ -152,4 +152,4 @@
     return h;
   }
 
-}
\ No newline at end of file
+}

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/function/FieldCacheSource.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/function/FieldCacheSource.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/function/FieldCacheSource.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/function/FieldCacheSource.java Wed Jul
15 17:21:04 2009
@@ -18,7 +18,6 @@
 package org.apache.solr.search.function;
 
 import org.apache.lucene.search.FieldCache;
-import org.apache.lucene.search.ExtendedFieldCache;
 
 /**
  * A base class for ValueSource implementations that retrieve values for
@@ -28,7 +27,7 @@
  */
 public abstract class FieldCacheSource extends ValueSource {
   protected String field;
-  protected FieldCache cache = ExtendedFieldCache.EXT_DEFAULT;
+  protected FieldCache cache = FieldCache.DEFAULT;
 
   public FieldCacheSource(String field) {
     this.field=field;

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/function/LongFieldSource.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/function/LongFieldSource.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/function/LongFieldSource.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/function/LongFieldSource.java Wed Jul
15 17:21:04 2009
@@ -18,7 +18,7 @@
 package org.apache.solr.search.function;
 
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.search.ExtendedFieldCache;
+import org.apache.lucene.search.FieldCache;
 
 
 import java.io.IOException;
@@ -32,13 +32,13 @@
  */
 
 public class LongFieldSource extends FieldCacheSource {
-  protected ExtendedFieldCache.LongParser parser;
+  protected FieldCache.LongParser parser;
 
   public LongFieldSource(String field) {
     this(field, null);
   }
 
-  public LongFieldSource(String field, ExtendedFieldCache.LongParser parser) {
+  public LongFieldSource(String field, FieldCache.LongParser parser) {
     super(field);
     this.parser = parser;
   }
@@ -49,8 +49,8 @@
 
   public DocValues getValues(IndexReader reader) throws IOException {
     final long[] arr = (parser == null) ?
-            ((ExtendedFieldCache) cache).getLongs(reader, field) :
-            ((ExtendedFieldCache) cache).getLongs(reader, field, parser);
+            ((FieldCache) cache).getLongs(reader, field) :
+            ((FieldCache) cache).getLongs(reader, field, parser);
     return new DocValues() {
       public float floatVal(int doc) {
         return (float) arr[doc];
@@ -129,4 +129,4 @@
     return h;
   }
 
-}
\ No newline at end of file
+}

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/function/StringIndexDocValues.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/function/StringIndexDocValues.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/function/StringIndexDocValues.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/function/StringIndexDocValues.java Wed
Jul 15 17:21:04 2009
@@ -18,7 +18,6 @@
 package org.apache.solr.search.function;
 
 import org.apache.lucene.search.FieldCache;
-import org.apache.lucene.search.ExtendedFieldCache;
 import org.apache.lucene.index.IndexReader;
 
 import java.io.IOException;

Modified: lucene/solr/trunk/src/test/org/apache/solr/util/TestOpenBitSet.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/util/TestOpenBitSet.java?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/util/TestOpenBitSet.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/util/TestOpenBitSet.java Wed Jul 15 17:21:04
2009
@@ -23,6 +23,7 @@
 import java.util.BitSet;
 
 import org.apache.lucene.util.OpenBitSetIterator;
+import org.apache.lucene.search.DocIdSetIterator;
 
 /**
  * @deprecated
@@ -62,7 +63,7 @@
         iterator.skipTo(bb+1);
         bb = iterator.doc();
       }
-      assertEquals(aa,bb);
+      assertEquals(aa == -1 ? DocIdSetIterator.NO_MORE_DOCS : aa, bb);
     } while (aa>=0);
   }
 

Modified: lucene/solr/trunk/src/webapp/web/admin/analysis.jsp
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/analysis.jsp?rev=794328&r1=794327&r2=794328&view=diff
==============================================================================
--- lucene/solr/trunk/src/webapp/web/admin/analysis.jsp (original)
+++ lucene/solr/trunk/src/webapp/web/admin/analysis.jsp Wed Jul 15 17:21:04 2009
@@ -19,8 +19,8 @@
                  org.apache.lucene.analysis.Token,
                  org.apache.lucene.analysis.TokenStream,
                  org.apache.lucene.index.Payload,
-                 org.apache.solr.analysis.CharReader,
-                 org.apache.solr.analysis.CharStream,
+                 org.apache.lucene.analysis.CharReader,
+                 org.apache.lucene.analysis.CharStream,
                  org.apache.solr.analysis.CharFilterFactory,
                  org.apache.solr.analysis.TokenFilterFactory,
                  org.apache.solr.analysis.TokenizerChain,



Mime
View raw message