lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r801872 - in /lucene/solr/trunk: ./ lib/ src/java/org/apache/solr/handler/component/ src/java/org/apache/solr/highlight/ src/java/org/apache/solr/schema/ src/java/org/apache/solr/search/ src/java/org/apache/solr/update/ src/java/org/apache/...
Date Fri, 07 Aug 2009 03:21:08 GMT
Author: markrmiller
Date: Fri Aug  7 03:21:06 2009
New Revision: 801872

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

Modified:
    lucene/solr/trunk/CHANGES.txt
    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/handler/component/QueryComponent.java
    lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
    lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
    lucene/solr/trunk/src/java/org/apache/solr/highlight/GapFragmenter.java
    lucene/solr/trunk/src/java/org/apache/solr/highlight/RegexFragmenter.java
    lucene/solr/trunk/src/java/org/apache/solr/schema/RandomSortField.java
    lucene/solr/trunk/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java
    lucene/solr/trunk/src/java/org/apache/solr/search/SolrQueryParser.java
    lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java
    lucene/solr/trunk/src/java/org/apache/solr/util/HighlightingUtils.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Fri Aug  7 03:21:06 2009
@@ -575,6 +575,8 @@
 
 43. SOLR-1261: Lucene trunk renamed RangeQuery & Co to TermRangeQuery (Uwe Schindler
via shalin)
 
+44. Upgraded to Lucene 2.9-dev r801856 (Mark Miller)
+
 Build
 ----------------------
  1. SOLR-776: Added in ability to sign artifacts via Ant for releases (gsingers)

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=801872&r1=801871&r2=801872&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=801872&r1=801871&r2=801872&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=801872&r1=801871&r2=801872&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=801872&r1=801871&r2=801872&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=801872&r1=801871&r2=801872&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=801872&r1=801871&r2=801872&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=801872&r1=801871&r2=801872&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=801872&r1=801871&r2=801872&view=diff
==============================================================================
Binary files - no diff available.

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=801872&r1=801871&r2=801872&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 Fri Aug
 7 03:21:06 2009
@@ -225,8 +225,8 @@
           }
 
           if (comparator == null) {
-            comparator = sortField.getComparator(1,0,sortField.getReverse());
-            comparator.setNextReader(subReader, offset, 0);
+            comparator = sortField.getComparator(1,0);
+            comparator.setNextReader(subReader, offset);
             if (comparators != null)
               comparators[idx] = comparator;
           }

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryElevationComponent.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
(original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
Fri Aug  7 03:21:06 2009
@@ -477,7 +477,7 @@
         values[slot] = docVal(doc);
       }
 
-      public void setNextReader(IndexReader reader, int docBase, int numSlotsFull) throws
IOException {
+      public void setNextReader(IndexReader reader, int docBase) throws IOException {
         idIndex = FieldCache.DEFAULT.getStringIndex(reader, fieldname);
       }
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java Fri Aug
 7 03:21:06 2009
@@ -133,19 +133,21 @@
    * @param request The SolrQueryRequest
    * @throws IOException 
    */
-  private SpanScorer getSpanQueryScorer(Query query, String fieldName, CachingTokenFilter
tokenStream, SolrQueryRequest request) throws IOException {
+  private QueryScorer getSpanQueryScorer(Query query, String fieldName, TokenStream tokenStream,
SolrQueryRequest request) throws IOException {
     boolean reqFieldMatch = request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH,
false);
     Boolean highlightMultiTerm = request.getParams().getBool(HighlightParams.HIGHLIGHT_MULTI_TERM);
     if(highlightMultiTerm == null) {
       highlightMultiTerm = false;
     }
-
+    QueryScorer scorer;
     if (reqFieldMatch) {
-      return new SpanScorer(query, fieldName, tokenStream, highlightMultiTerm);
+      scorer = new QueryScorer(query, fieldName);
     }
     else {
-      return new SpanScorer(query, null, tokenStream, highlightMultiTerm);
+      scorer = new QueryScorer(query, null);
     }
+    scorer.setExpandMultiTermQuery(highlightMultiTerm);
+    return scorer;
   }
 
   /**
@@ -154,13 +156,13 @@
    * @param fieldName The name of the field
    * @param request The SolrQueryRequest
    */
-  protected QueryScorer getQueryScorer(Query query, String fieldName, SolrQueryRequest request)
{
+  protected QueryTermScorer getQueryScorer(Query query, String fieldName, SolrQueryRequest
request) {
      boolean reqFieldMatch = request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH,
false);
      if (reqFieldMatch) {
-        return new QueryScorer(query, request.getSearcher().getReader(), fieldName);
+        return new QueryTermScorer(query, request.getSearcher().getReader(), fieldName);
      }
      else {
-        return new QueryScorer(query);
+        return new QueryTermScorer(query);
      }
   }
   

Modified: lucene/solr/trunk/src/java/org/apache/solr/highlight/GapFragmenter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/highlight/GapFragmenter.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/highlight/GapFragmenter.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/highlight/GapFragmenter.java Fri Aug  7 03:21:06
2009
@@ -17,6 +17,10 @@
 package org.apache.solr.highlight;
 
 import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
+import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
+import org.apache.lucene.analysis.tokenattributes.TermAttribute;
 import org.apache.lucene.search.highlight.Fragmenter;
 import org.apache.lucene.search.highlight.NullFragmenter;
 import org.apache.lucene.search.highlight.SimpleFragmenter;
@@ -77,6 +81,9 @@
   public static final int INCREMENT_THRESHOLD = 50;
   protected int fragOffset = 0;
   
+  private OffsetAttribute offsetAtt;
+  private PositionIncrementAttribute posIncAtt;
+  
   public LuceneGapFragmenter() {
   }
   
@@ -87,19 +94,22 @@
   /* (non-Javadoc)
    * @see org.apache.lucene.search.highlight.TextFragmenter#start(java.lang.String)
    */
-  public void start(String originalText) {
+  public void start(String originalText, TokenStream tokenStream) {
+    offsetAtt = (OffsetAttribute) tokenStream.getAttribute(OffsetAttribute.class);
+    posIncAtt = (PositionIncrementAttribute) tokenStream.getAttribute(PositionIncrementAttribute.class);
     fragOffset = 0;
   }
 
   /* (non-Javadoc)
    * @see org.apache.lucene.search.highlight.TextFragmenter#isNewFragment(org.apache.lucene.analysis.Token)
    */
-  public boolean isNewFragment(Token token) {
+  public boolean isNewFragment() {
+    int endOffset = offsetAtt.endOffset();
     boolean isNewFrag = 
-      token.endOffset() >= fragOffset + getFragmentSize() ||
-      token.getPositionIncrement() > INCREMENT_THRESHOLD;
+      endOffset >= fragOffset + getFragmentSize() ||
+      posIncAtt.getPositionIncrement() > INCREMENT_THRESHOLD;
     if(isNewFrag) {
-        fragOffset = token.endOffset();
+        fragOffset = endOffset;
     }
     return isNewFrag;
   }

Modified: lucene/solr/trunk/src/java/org/apache/solr/highlight/RegexFragmenter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/highlight/RegexFragmenter.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/highlight/RegexFragmenter.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/highlight/RegexFragmenter.java Fri Aug  7 03:21:06
2009
@@ -21,7 +21,9 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
+import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
 import org.apache.lucene.search.highlight.Fragmenter;
 import org.apache.lucene.search.highlight.NullFragmenter;
 import org.apache.solr.common.params.DefaultSolrParams;
@@ -146,6 +148,9 @@
   protected int targetOffset;
   protected int[] hotspots;
 
+  private PositionIncrementAttribute posIncAtt;
+  private OffsetAttribute offsetAtt;
+
   // ** other
   // note: could dynamically change size of sentences extracted to match
   // target frag size
@@ -193,10 +198,12 @@
   /* (non-Javadoc)
    * @see org.apache.lucene.search.highlight.TextFragmenter#start(java.lang.String)
    */
-  public void start(String originalText) {
+  public void start(String originalText, TokenStream tokenStream) {
     currentNumFrags = 1;
     currentOffset = 0;
     addHotSpots(originalText);
+    posIncAtt = (PositionIncrementAttribute) tokenStream.getAttribute(PositionIncrementAttribute.class);
+    offsetAtt = (OffsetAttribute) tokenStream.getAttribute(OffsetAttribute.class);
   }
 
   ////////////////////////////////////
@@ -231,23 +238,24 @@
   /* (non-Javadoc)
    * @see org.apache.lucene.search.highlight.TextFragmenter#isNewFragment(org.apache.lucene.analysis.Token)
    */
-  public boolean isNewFragment(Token token)
+  public boolean isNewFragment()
   {
     boolean isNewFrag = false;
     int minFragLen = (int)((1.0f - slop)*targetFragChars);
-
+    int endOffset = offsetAtt.endOffset();
+    
     // ** determin isNewFrag
-    if(token.getPositionIncrement() > incrementGapThreshold) {
+    if(posIncAtt.getPositionIncrement() > incrementGapThreshold) {
       // large position gaps always imply new fragments
       isNewFrag = true;
 
-    } else if(token.endOffset() - currentOffset < minFragLen) {
+    } else if(endOffset - currentOffset < minFragLen) {
       // we're not in our range of flexibility
       isNewFrag = false;
 
     } else if(targetOffset > 0) {
       // we've already decided on a target
-      isNewFrag = token.endOffset() > targetOffset;
+      isNewFrag = endOffset > targetOffset;
 
     } else {
       // we might be able to do something
@@ -256,7 +264,7 @@
       int hotIndex;
 
       // look for a close hotspot
-      hotIndex = Arrays.binarySearch(hotspots, token.endOffset());
+      hotIndex = Arrays.binarySearch(hotspots, endOffset);
       if(hotIndex < 0) hotIndex = -hotIndex;
       if(hotIndex >= hotspots.length) {
         // no more hotspots in this input stream
@@ -276,13 +284,13 @@
         targetOffset = goal <= maxOffset ? goal : currentOffset + targetFragChars;
       }
 
-      isNewFrag = token.endOffset() > targetOffset;
+      isNewFrag = endOffset > targetOffset;
     }      
       
     // ** operate on isNewFrag
     if(isNewFrag) {
         currentNumFrags++;
-        currentOffset = token.endOffset();
+        currentOffset = endOffset;
         targetOffset = -1;
     }
     return isNewFrag;

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/RandomSortField.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/RandomSortField.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/RandomSortField.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/RandomSortField.java Fri Aug  7 03:21:06
2009
@@ -130,7 +130,7 @@
           values[slot] = hash(doc+seed);
         }
 
-        public void setNextReader(IndexReader reader, int docBase, int numSlotsFull) throws
IOException {
+        public void setNextReader(IndexReader reader, int docBase) throws IOException {
           seed = getSeed(fieldname, reader);
         }
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java
(original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java
Fri Aug  7 03:21:06 2009
@@ -177,7 +177,7 @@
       readerGen[slot] = currentReaderGen;
     }
 
-    public void setNextReader(IndexReader reader, int docBase,  int numSlotsFull) throws
IOException {
+    public void setNextReader(IndexReader reader, int docBase) throws IOException {
       FieldCache.StringIndex currentReaderValues = FieldCache.DEFAULT.getStringIndex(reader,
field);
       currentReaderGen++;
       order = currentReaderValues.order;

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/SolrQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/SolrQueryParser.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/SolrQueryParser.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/SolrQueryParser.java Fri Aug  7 03:21:06
2009
@@ -144,7 +144,7 @@
     // (sortable numeric types don't do prefixes, but can do range queries)
     Term t = new Term(field, termStr);
     PrefixQuery prefixQuery = new PrefixQuery(t);
-    prefixQuery.setConstantScoreRewrite(true);
+    prefixQuery.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
     return prefixQuery;
   }
 
@@ -153,7 +153,7 @@
     if (q instanceof WildcardQuery) {
       // use a constant score query to avoid overflowing clauses
       WildcardQuery wildcardQuery = new WildcardQuery(((WildcardQuery)q).getTerm());
-      wildcardQuery.setConstantScoreRewrite(true);
+      wildcardQuery.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
       return  wildcardQuery; 
     }
     return q;

Modified: lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java Fri Aug  7 03:21:06
2009
@@ -33,6 +33,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
 import java.text.DateFormat;
 import java.util.Date;
 
@@ -71,7 +72,10 @@
       if (config.maxMergeDocs != -1) setMaxMergeDocs(config.maxMergeDocs);
       if (config.maxFieldLength != -1) setMaxFieldLength(config.maxFieldLength);
       if (config.mergePolicyClassName != null && SolrIndexConfig.DEFAULT_MERGE_POLICY_CLASSNAME.equals(config.mergePolicyClassName)
== false) {
-        MergePolicy policy = (MergePolicy) schema.getResourceLoader().newInstance(config.mergePolicyClassName);
+        MergePolicy policy = null;
+
+        policy = (MergePolicy) schema.getResourceLoader().newInstance(config.mergePolicyClassName,
new String[]{}, new Class[]{IndexWriter.class}, new Object[] { this });
+
         setMergePolicy(policy);///hmm, is this really the best way to get a newInstance?
       }
       if (config.mergeFactor != -1 && getMergePolicy() instanceof LogMergePolicy)
{

Modified: lucene/solr/trunk/src/java/org/apache/solr/util/HighlightingUtils.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/util/HighlightingUtils.java?rev=801872&r1=801871&r2=801872&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/util/HighlightingUtils.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/util/HighlightingUtils.java Fri Aug  7 03:21:06
2009
@@ -92,7 +92,7 @@
     * @deprecated use DefaultSolrHighlighter
     * @see DefaultSolrHighlighter
     */
-   public static QueryScorer getQueryScorer(Query query, String fieldName, SolrQueryRequest
request) {
+   public static QueryTermScorer getQueryScorer(Query query, String fieldName, SolrQueryRequest
request) {
      return HIGHLIGHTER.getQueryScorerX(query, fieldName, request);
    }
    
@@ -145,7 +145,7 @@
   Highlighter getHighlighterX(Query query, String fieldName, SolrQueryRequest request) {
     return getHighlighter(query, fieldName, request);
   }
-  QueryScorer getQueryScorerX(Query query, String fieldName, SolrQueryRequest request) {
+  QueryTermScorer getQueryScorerX(Query query, String fieldName, SolrQueryRequest request)
{
     return getQueryScorer(query, fieldName, request);
   }
   int getMaxSnippetsX(String fieldName, SolrQueryRequest request) {



Mime
View raw message