You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/04/26 16:35:24 UTC

svn commit: r1096764 - in /lucene/dev/trunk: lucene/src/java/org/apache/lucene/index/ solr/ solr/src/java/org/apache/solr/handler/component/ solr/src/java/org/apache/solr/request/ solr/src/java/org/apache/solr/search/ solr/src/test-framework/org/apache...

Author: rmuir
Date: Tue Apr 26 14:35:23 2011
New Revision: 1096764

URL: http://svn.apache.org/viewvc?rev=1096764&view=rev
Log:
SOLR-2272: revert r1096610

Removed:
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/JoinQParserPlugin.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/TestJoin.java
Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocTermOrds.java
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/ResponseBuilder.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/request/SimpleFacets.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrRequestInfo.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/request/UnInvertedField.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/BitDocSet.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSet.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSlice.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/HashDocSet.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/QParserPlugin.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/SortedIntDocSet.java
    lucene/dev/trunk/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocTermOrds.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocTermOrds.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocTermOrds.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocTermOrds.java Tue Apr 26 14:35:23 2011
@@ -129,8 +129,6 @@ public class DocTermOrds {
   protected BytesRef prefix;
   protected int ordBase;
 
-  protected DocsEnum docsEnum; //used while uninverting
-
   public long ramUsedInBytes() {
     // can cache the mem size since it shouldn't change
     if (memsz!=0) return memsz;
@@ -272,7 +270,7 @@ public class DocTermOrds {
     // frequent terms ahead of time.
 
     int termNum = 0;
-    docsEnum = null;
+    DocsEnum docsEnum = null;
 
     // Loop begins with te positioned to first term (we call
     // seek above):

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Tue Apr 26 14:35:23 2011
@@ -137,12 +137,6 @@ New Features
 * SOLR-2383: /browse improvements: generalize range and date facet display
   (Jan Høydahl via yonik)
 
-* SOLR-2272: Pseudo-join queries / filters.  Examples:
-  To restrict to the set of parents with at least one blue-eyed child:
-    fq={!join from=parent to=name}eyes:blue
-  To restrict to the set of children with at least one blue-eyed parent:
-    fq={!join from=name to=parent}eyes:blue
-  (yonik)
 
 
 Optimizations

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/ResponseBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/ResponseBuilder.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/ResponseBuilder.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/handler/component/ResponseBuilder.java Tue Apr 26 14:35:23 2011
@@ -163,25 +163,6 @@ public class ResponseBuilder
     debugInfo.add( name, val );
   }
 
-  public void addDebug(Object val, String... path) {
-    if( debugInfo == null ) {
-      debugInfo = new SimpleOrderedMap<Object>();
-    }
-
-    NamedList<Object> target = debugInfo;
-    for (int i=0; i<path.length-1; i++) {
-      String elem = path[i];
-      NamedList<Object> newTarget = (NamedList<Object>)debugInfo.get(elem);
-      if (newTarget == null) {
-        newTarget = new SimpleOrderedMap<Object>();
-        target.add(elem, newTarget);
-      }
-      target = newTarget;
-    }
-
-    target.add(path[path.length-1], val);
-  }
-
   //-------------------------------------------------------------------------
   //-------------------------------------------------------------------------
 

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/request/SimpleFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/request/SimpleFacets.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/request/SimpleFacets.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/request/SimpleFacets.java Tue Apr 26 14:35:23 2011
@@ -21,7 +21,6 @@ import org.apache.lucene.index.*;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.*;
 import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.StringHelper;
 import org.apache.lucene.util.packed.Direct16;
 import org.apache.lucene.util.packed.Direct32;
 import org.apache.lucene.util.packed.Direct8;
@@ -683,15 +682,14 @@ public class SimpleFacets {
 
             if (deState==null) {
               deState = new SolrIndexSearcher.DocsEnumState();
-              deState.fieldName = StringHelper.intern(field);
               deState.deletedDocs = MultiFields.getDeletedDocs(r);
               deState.termsEnum = termsEnum;
-              deState.docsEnum = docsEnum;
+              deState.reuse = docsEnum;
             }
 
-            c = searcher.numDocs(docs, deState);
+            c = searcher.numDocs(new TermQuery(t), docs, deState);
 
-            docsEnum = deState.docsEnum;
+            docsEnum = deState.reuse;
           } else {
             // iterate over TermDocs to calculate the intersection
 

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrRequestInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrRequestInfo.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrRequestInfo.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrRequestInfo.java Tue Apr 26 14:35:23 2011
@@ -17,15 +17,11 @@
 
 package org.apache.solr.request;
 
-import org.apache.solr.common.SolrException;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.handler.component.ResponseBuilder;
 import org.apache.solr.response.SolrQueryResponse;
 
-import java.io.Closeable;
 import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
 
 
 public class SolrRequestInfo {
@@ -35,8 +31,6 @@ public class SolrRequestInfo {
   protected SolrQueryResponse rsp;
   protected Date now;
   protected ResponseBuilder rb;
-  protected List<Closeable> closeHooks;
-
 
   public static SolrRequestInfo getRequestInfo() {
     return threadLocal.get();
@@ -54,20 +48,7 @@ public class SolrRequestInfo {
   }
 
   public static void clearRequestInfo() {
-    try {
-      SolrRequestInfo info = threadLocal.get();
-      if (info != null && info.closeHooks != null) {
-        for (Closeable hook : info.closeHooks) {
-          try {
-            hook.close();
-          } catch (Throwable throwable) {
-            SolrException.log(SolrCore.log, "Exception during close hook", throwable);
-          }
-        }
-      }
-    } finally {
-      threadLocal.remove();
-    }
+    threadLocal.remove();
   }
 
   public SolrRequestInfo(SolrQueryRequest req, SolrQueryResponse rsp) {
@@ -107,14 +88,4 @@ public class SolrRequestInfo {
   public void setResponseBuilder(ResponseBuilder rb) {
     this.rb = rb;
   }
-
-  public void addCloseHook(Closeable hook) {
-    // is this better here, or on SolrQueryRequest?
-    synchronized (this) {
-      if (closeHooks == null) {
-        closeHooks = new LinkedList<Closeable>();
-      }
-      closeHooks.add(hook);
-    }
-  }
 }

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/request/UnInvertedField.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/request/UnInvertedField.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/request/UnInvertedField.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/request/UnInvertedField.java Tue Apr 26 14:35:23 2011
@@ -23,7 +23,6 @@ import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TermRangeQuery;
-import org.apache.lucene.util.StringHelper;
 import org.apache.noggit.CharArr;
 import org.apache.solr.common.params.FacetParams;
 import org.apache.solr.common.util.NamedList;
@@ -123,15 +122,11 @@ public class UnInvertedField extends Doc
 
       if (deState == null) {
         deState = new SolrIndexSearcher.DocsEnumState();
-        deState.fieldName = StringHelper.intern(field);
-        // deState.termsEnum = te.tenum;
-        deState.termsEnum = te;  // TODO: check for MultiTermsEnum in SolrIndexSearcher could now fail?
-        deState.docsEnum = docsEnum;
-        deState.minSetSizeCached = maxTermDocFreq;
-      }
-      docsEnum = deState.docsEnum;
-      DocSet set = searcher.getDocSet(deState);
-      maxTermCounts[termNum] = set.size();
+        deState.termsEnum = te;
+      }
+
+      maxTermCounts[termNum] = searcher.getDocSet(new TermQuery(new Term(field, topTerm.term)), deState).size();
+      //System.out.println("  big term termNum=" + termNum + " term=" + topTerm.term.utf8ToString() + " size=" + maxTermCounts[termNum] + " dF=" + te.docFreq());
     }
   }
 
@@ -163,10 +158,10 @@ public class UnInvertedField extends Doc
     super(field,
           // threshold, over which we use set intersections instead of counting
           // to (1) save memory, and (2) speed up faceting.
-          // Add 2 for testing purposes so that there will always be some terms under
+          // Add 1 for testing purposes so that there will always be some terms under
           // the threshold even when the index is very
           // small.
-          searcher.maxDoc()/20 + 2,
+          searcher.maxDoc()/20 + 1,
           DEFAULT_INDEX_INTERVAL_BITS);
     //System.out.println("maxTermDocFreq=" + maxTermDocFreq + " maxDoc=" + searcher.maxDoc());
 

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/BitDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/BitDocSet.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/BitDocSet.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/BitDocSet.java Tue Apr 26 14:35:23 2011
@@ -161,16 +161,6 @@ public class BitDocSet extends DocSetBas
   }
 
   @Override
-  public boolean intersects(DocSet other) {
-    if (other instanceof BitDocSet) {
-      return bits.intersects(((BitDocSet)other).bits);
-    } else {
-      // they had better not call us back!
-      return other.intersects(this);
-    }
-  }
-
-  @Override
   public int unionSize(DocSet other) {
     if (other instanceof BitDocSet) {
       // if we don't know our current size, this is faster than
@@ -194,11 +184,6 @@ public class BitDocSet extends DocSetBas
   }
 
   @Override
-  public void setBitsOn(OpenBitSet target) {
-    target.union(bits);
-  }
-
-  @Override
    public DocSet andNot(DocSet other) {
     OpenBitSet newbits = (OpenBitSet)(bits.clone());
      if (other instanceof BitDocSet) {
@@ -226,9 +211,4 @@ public class BitDocSet extends DocSetBas
   public long memSize() {
     return (bits.getBits().length << 3) + 16;
   }
-
-  @Override
-  protected BitDocSet clone() {
-    return new BitDocSet((OpenBitSet)bits.clone(), size);
-  }
 }

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSet.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSet.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSet.java Tue Apr 26 14:35:23 2011
@@ -115,9 +115,6 @@ public interface DocSet /* extends Colle
    */
   public int intersectionSize(DocSet other);
 
-  /** Returns true if these sets have any elements in common */
-  public boolean intersects(DocSet other);
-
   /**
    * Returns the union of this set with another set.  Neither set is modified - a new DocSet is
    * created and returned.
@@ -149,14 +146,6 @@ public interface DocSet /* extends Colle
    * methods will be invoked with.
    */
   public Filter getTopFilter();
-
-  /**
-   * Takes the docs from this set and sets those bits on the target OpenBitSet.
-   * The target should be sized large enough to accommodate all of the documents before calling this method.
-   */
-  public void setBitsOn(OpenBitSet target);
-
-  public static DocSet EMPTY = new SortedIntDocSet(new int[0], 0);
 }
 
 /** A base class that may be usefull for implementing DocSets */
@@ -224,17 +213,6 @@ abstract class DocSetBase implements Doc
     return new BitDocSet(newbits);
   }
 
-  public boolean intersects(DocSet other) {
-    // intersection is overloaded in the smaller DocSets to be more
-    // efficient, so dispatch off of it instead.
-    if (!(other instanceof BitDocSet)) {
-      return other.intersects(this);
-    }
-    // less efficient way: get the intersection size
-    return intersectionSize(other) > 0;
-  }
-
-
   public DocSet union(DocSet other) {
     OpenBitSet newbits = (OpenBitSet)(this.getBits().clone());
     newbits.or(other.getBits());
@@ -317,14 +295,6 @@ abstract class DocSetBase implements Doc
       }
     };
   }
-
-  public void setBitsOn(OpenBitSet target) {
-    DocIterator iter = iterator();
-    while (iter.hasNext()) {
-      target.fastSet(iter.nextDoc());
-    }
-  }
-
 }
 
 

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSlice.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSlice.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSlice.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/DocSlice.java Tue Apr 26 14:35:23 2011
@@ -17,8 +17,6 @@
 
 package org.apache.solr.search;
 
-import java.util.Arrays;
-
 /**
  * <code>DocSlice</code> implements DocList as an array of docids and optional scores.
  *
@@ -143,22 +141,4 @@ public class DocSlice extends DocSetBase
     HashDocSet h = new HashDocSet(docs,offset,len);
     return h.intersectionSize(other);  
   }
-
-  @Override
-  public boolean intersects(DocSet other) {
-    if (other instanceof SortedIntDocSet || other instanceof HashDocSet) {
-      return other.intersects(this);
-    }
-    HashDocSet h = new HashDocSet(docs,offset,len);
-    return h.intersects(other);
-  }
-
-  @Override
-  protected DocSlice clone() {
-    try {
-      // DocSlice is not currently mutable
-      DocSlice slice = (DocSlice) super.clone();
-    } catch (CloneNotSupportedException e) {}
-    return null;
-  }
 }

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/HashDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/HashDocSet.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/HashDocSet.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/HashDocSet.java Tue Apr 26 14:35:23 2011
@@ -48,12 +48,6 @@ public final class HashDocSet extends Do
 
   private final int mask;
 
-  public HashDocSet(HashDocSet set) {
-    this.table = set.table.clone();
-    this.size = set.size;
-    this.mask = set.mask;
-  }
-
   /** Create a HashDocSet from a list of *unique* ids */
   public HashDocSet(int[] docs, int offset, int len) {
     this(docs, offset, len, DEFAULT_INVERSE_LOAD_FACTOR);
@@ -213,31 +207,6 @@ public final class HashDocSet extends Do
 
   }
 
-  @Override
-  public boolean intersects(DocSet other) {
-   if (other instanceof HashDocSet) {
-     // set "a" to the smallest doc set for the most efficient
-     // intersection.
-     final HashDocSet a = size()<=other.size() ? this : (HashDocSet)other;
-     final HashDocSet b = size()<=other.size() ? (HashDocSet)other : this;
-
-     for (int i=0; i<a.table.length; i++) {
-       int id=a.table[i];
-       if (id >= 0 && b.exists(id)) {
-         return true;
-       }
-     }
-     return false;
-   } else {
-     for (int i=0; i<table.length; i++) {
-       int id=table[i];
-       if (id >= 0 && other.exists(id)) {
-         return true;
-       }
-     }
-     return false;
-   }
-  }
 
   @Override
   public DocSet andNot(DocSet other) {
@@ -280,10 +249,6 @@ public final class HashDocSet extends Do
    }
   }
 
-  @Override
-  protected HashDocSet clone() {
-    return new HashDocSet(this);
-  }
 
   // don't implement andNotSize() and unionSize() on purpose... they are implemented
   // in BaseDocSet in terms of intersectionSize().

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/QParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/QParserPlugin.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/QParserPlugin.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/QParserPlugin.java Tue Apr 26 14:35:23 2011
@@ -40,7 +40,6 @@ public abstract class QParserPlugin impl
     FunctionRangeQParserPlugin.NAME, FunctionRangeQParserPlugin.class,
     SpatialFilterQParserPlugin.NAME, SpatialFilterQParserPlugin.class,
     SpatialBoxQParserPlugin.NAME, SpatialBoxQParserPlugin.class,
-    JoinQParserPlugin.NAME, JoinQParserPlugin.class,
   };
 
   /** return a {@link QParser} */

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java Tue Apr 26 14:35:23 2011
@@ -28,17 +28,12 @@ import org.apache.lucene.store.FSDirecto
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.OpenBitSet;
-import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrInfoMBean;
-import org.apache.solr.request.LocalSolrQueryRequest;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.request.SolrRequestInfo;
 import org.apache.solr.request.UnInvertedField;
-import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
 import org.slf4j.Logger;
@@ -194,10 +189,6 @@ public class SolrIndexSearcher extends I
     return name;
   }
 
-  public SolrCore getCore() {
-    return core;
-  }
-
 
   /** Register sub-objects such as caches
    */
@@ -585,6 +576,32 @@ public class SolrIndexSearcher extends I
     return answer;
   }
 
+  /** lucene.internal */
+  public DocSet getDocSet(Query query, DocsEnumState deState) throws IOException {
+    // Get the absolute value (positive version) of this query.  If we
+    // get back the same reference, we know it's positive.
+    Query absQ = QueryUtils.getAbs(query);
+    boolean positive = query==absQ;
+
+    if (filterCache != null) {
+      DocSet absAnswer = filterCache.get(absQ);
+      if (absAnswer!=null) {
+        if (positive) return absAnswer;
+        else return getPositiveDocSet(matchAllDocsQuery).andNot(absAnswer);
+      }
+    }
+
+    DocSet absAnswer = getDocSetNC(absQ, null, deState);
+    DocSet answer = positive ? absAnswer : getPositiveDocSet(matchAllDocsQuery, deState).andNot(absAnswer);
+
+    if (filterCache != null) {
+      // cache negative queries as positive
+      filterCache.put(absQ, absAnswer);
+    }
+
+    return answer;
+  }
+
   // only handle positive (non negative) queries
   DocSet getPositiveDocSet(Query q) throws IOException {
     DocSet answer;
@@ -597,6 +614,18 @@ public class SolrIndexSearcher extends I
     return answer;
   }
 
+  // only handle positive (non negative) queries
+  DocSet getPositiveDocSet(Query q, DocsEnumState deState) throws IOException {
+    DocSet answer;
+    if (filterCache != null) {
+      answer = filterCache.get(q);
+      if (answer!=null) return answer;
+    }
+    answer = getDocSetNC(q,null,deState);
+    if (filterCache != null) filterCache.put(q,answer);
+    return answer;
+  }
+
   private static Query matchAllDocsQuery = new MatchAllDocsQuery();
 
   /**
@@ -727,31 +756,21 @@ public class SolrIndexSearcher extends I
 
   }
 
-  /** lucene.internal */
-  public DocSet getDocSet(DocsEnumState deState) throws IOException {
-    int largestPossible = deState.termsEnum.docFreq();
-    boolean useCache = filterCache != null && largestPossible >= deState.minSetSizeCached;
-    TermQuery key = null;
-
-    if (useCache) {
-      key = new TermQuery(new Term(deState.fieldName, new BytesRef(deState.termsEnum.term()), false));
-      DocSet result = filterCache.get(key);
-      if (result != null) return result;
-    }
+  // query must be positive
+  protected DocSet getDocSetNC(Query query, DocSet filter, DocsEnumState deState) throws IOException {
+    if (filter != null) return getDocSetNC(query, filter, null);
 
     int smallSetSize = maxDoc()>>6;
-    int scratchSize = Math.min(smallSetSize, largestPossible);
-    if (deState.scratch == null || deState.scratch.length < scratchSize)
-      deState.scratch = new int[scratchSize];
+    int largestPossible = deState.termsEnum.docFreq();
 
-    final int[] docs = deState.scratch;
+    int[] docs = new int[Math.min(smallSetSize, largestPossible)];
     int upto = 0;
     int bitsSet = 0;
     OpenBitSet obs = null;
 
-    DocsEnum docsEnum = deState.termsEnum.docs(deState.deletedDocs, deState.docsEnum);
-    if (deState.docsEnum == null) {
-      deState.docsEnum = docsEnum;
+    DocsEnum docsEnum = deState.termsEnum.docs(deState.deletedDocs, deState.reuse);
+    if (deState.reuse == null) {
+      deState.reuse = docsEnum;
     }
 
     if (docsEnum instanceof MultiDocsEnum) {
@@ -803,22 +822,15 @@ public class SolrIndexSearcher extends I
       }
     }
 
-    DocSet result;
     if (obs != null) {
       for (int i=0; i<upto; i++) {
         obs.fastSet(docs[i]);  
       }
       bitsSet += upto;
-      result = new BitDocSet(obs, bitsSet);
-    } else {
-      result = new SortedIntDocSet(Arrays.copyOf(docs, upto));
+      return new BitDocSet(obs, bitsSet);
     }
 
-    if (useCache) {
-      filterCache.put(key, result);
-    }
-    
-    return result;
+    return new SortedIntDocSet(docs, upto);
   }
 
   // query must be positive
@@ -1628,20 +1640,17 @@ public class SolrIndexSearcher extends I
   }
 
   /** @lucene.internal */
-  public int numDocs(DocSet a, DocsEnumState deState) throws IOException {
+  public int numDocs(Query a, DocSet b, DocsEnumState deState) throws IOException {
     // Negative query if absolute value different from original
-    return a.intersectionSize(getDocSet(deState));
+    Query absQ = QueryUtils.getAbs(a);
+    DocSet positiveA = getPositiveDocSet(absQ, deState);
+    return a==absQ ? b.intersectionSize(positiveA) : b.andNotSize(positiveA);
   }
 
   public static class DocsEnumState {
-    public String fieldName;  // currently interned for as long as lucene requires it
     public TermsEnum termsEnum;
     public Bits deletedDocs;
-    public DocsEnum docsEnum;
-
-    public int minSetSizeCached;
-
-    public int[] scratch;
+    public DocsEnum reuse;
   }
 
    /**
@@ -1697,29 +1706,9 @@ public class SolrIndexSearcher extends I
     boolean logme = log.isInfoEnabled();
     long warmingStartTime = System.currentTimeMillis();
     // warm the caches in order...
-    ModifiableSolrParams params = new ModifiableSolrParams();
-    params.add("warming","true");
     for (int i=0; i<cacheList.length; i++) {
       if (logme) log.info("autowarming " + this + " from " + old + "\n\t" + old.cacheList[i]);
-
-
-      SolrQueryRequest req = new LocalSolrQueryRequest(core,params) {
-        @Override public SolrIndexSearcher getSearcher() { return SolrIndexSearcher.this; }
-        @Override public void close() { }
-      };
-
-      SolrQueryResponse rsp = new SolrQueryResponse();
-      SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp));
-      try {
-        this.cacheList[i].warm(this, old.cacheList[i]);
-      } finally {
-        try {
-          req.close();
-        } finally {
-          SolrRequestInfo.clearRequestInfo();
-        }
-      }
-
+      this.cacheList[i].warm(this, old.cacheList[i]);
       if (logme) log.info("autowarming result for " + this + "\n\t" + this.cacheList[i]);
     }
     warmupTime = System.currentTimeMillis() - warmingStartTime;

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/SortedIntDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/SortedIntDocSet.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/SortedIntDocSet.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/SortedIntDocSet.java Tue Apr 26 14:35:23 2011
@@ -166,59 +166,6 @@ public class SortedIntDocSet extends Doc
     return icount;
   }
 
-
-  public static boolean intersects(int[] smallerSortedList, int[] biggerSortedList) {
-    // see intersectionSize for more in-depth comments of this algorithm
-
-    final int a[] = smallerSortedList;
-    final int b[] = biggerSortedList;
-
-    int step = (b.length/a.length)+1;
-
-    step = step + step;
-
-    int low = 0;
-    int max = b.length-1;
-
-    for (int i=0; i<a.length; i++) {
-      int doca = a[i];
-      int high = max;
-      int probe = low + step;
-      if (probe<high) {
-        if (b[probe]>=doca) {
-          high=probe;
-        } else {
-          low=probe+1;
-          probe = low + step;
-          if (probe<high) {
-            if (b[probe]>=doca) {
-              high=probe;
-            } else {
-              low=probe+1;
-            }
-          }
-        }
-      }
-
-      while (low <= high) {
-        int mid = (low+high) >>> 1;
-        int docb = b[mid];
-
-        if (docb < doca) {
-          low = mid+1;
-        }
-        else if (docb > doca) {
-          high = mid-1;
-        }
-        else {
-          return true;
-        }
-      }
-    }
-
-    return false;
-  }
-
   public int intersectionSize(DocSet other) {
     if (!(other instanceof SortedIntDocSet)) {
       // assume other implementations are better at random access than we are,
@@ -268,49 +215,6 @@ public class SortedIntDocSet extends Doc
     return icount;
   }
 
-  @Override
-  public boolean intersects(DocSet other) {
-    if (!(other instanceof SortedIntDocSet)) {
-      // assume other implementations are better at random access than we are,
-      // true of BitDocSet and HashDocSet.
-      for (int i=0; i<docs.length; i++) {
-        if (other.exists(docs[i])) return true;
-      }
-      return false;
-    }
-
-    // make "a" the smaller set.
-    int[] otherDocs = ((SortedIntDocSet)other).docs;
-    final int[] a = docs.length < otherDocs.length ? docs : otherDocs;
-    final int[] b = docs.length < otherDocs.length ? otherDocs : docs;
-
-    if (a.length==0) return false;
-
-    // if b is 8 times bigger than a, use the modified binary search.
-    if ((b.length>>3) >= a.length) {
-      return intersects(a,b);
-    }
-
-    // if they are close in size, just do a linear walk of both.
-    int i=0,j=0;
-    int doca=a[i],docb=b[j];
-    for(;;) {
-      // switch on the sign bit somehow?  Hopefull JVM is smart enough to just test once.
-
-      // Since set a is less dense then set b, doca is likely to be greater than docb so
-      // check that case first.  This resulted in a 13% speedup.
-      if (doca > docb) {
-        if (++j >= b.length) break;
-        docb=b[j];
-      } else if (doca < docb) {
-        if (++i >= a.length) break;
-        doca=a[i];
-      } else {
-        return true;
-      }
-    }
-    return false;
-  }
 
   /** puts the intersection of a and b into the target array and returns the size */
   public static int intersection(int a[], int lena, int b[], int lenb, int[] target) {
@@ -559,13 +463,6 @@ public class SortedIntDocSet extends Doc
     return new SortedIntDocSet(arr,sz);
   }
 
-  @Override
-  public void setBitsOn(OpenBitSet target) {
-    for (int doc : docs) {
-      target.fastSet(doc);
-    }
-  }
-
 
   public boolean exists(int doc) {
     // this could be faster by estimating where in the list the doc is likely to appear,
@@ -756,8 +653,4 @@ public class SortedIntDocSet extends Doc
     };
   }
 
-  @Override
-  protected SortedIntDocSet clone() {
-    return new SortedIntDocSet(docs.clone());
-  }
 }

Modified: lucene/dev/trunk/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/trunk/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java Tue Apr 26 14:35:23 2011
@@ -722,7 +722,6 @@ public abstract class SolrTestCaseJ4 ext
   }
 
   public static final IRange ZERO_ONE = new IRange(0,1);
-  public static final IRange ZERO_TWO = new IRange(0,2);
   public static final IRange ONE_ONE = new IRange(1,1);
 
   public static class Doc implements Comparable{
@@ -1041,29 +1040,6 @@ public abstract class SolrTestCaseJ4 ext
     return out.toString();
   }
 
-  /** Return a Map from field value to a list of document ids */
-  Map<Comparable, List<Comparable>> invertField(Map<Comparable, Doc> model, String field) {
-    Map<Comparable, List<Comparable>> value_to_id = new HashMap<Comparable, List<Comparable>>();
-
-    // invert field
-    for (Comparable key : model.keySet()) {
-      Doc doc = model.get(key);
-      List<Comparable> vals = doc.getValues(field);
-      if (vals == null) continue;
-      for (Comparable val : vals) {
-        List<Comparable> ids = value_to_id.get(val);
-        if (ids == null) {
-          ids = new ArrayList<Comparable>(2);
-          value_to_id.put(val, ids);
-        }
-        ids.add(key);
-      }
-    }
-
-    return value_to_id;
-  }
-
-
   /** Gets a resource from the context classloader as {@link File}. This method should only be used,
    * if a real file is needed. To get a stream, code should prefer
    * {@link Class#getResourceAsStream} using {@code this.getClass()}.

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=1096764&r1=1096763&r2=1096764&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java Tue Apr 26 14:35:23 2011
@@ -26,7 +26,6 @@ import org.apache.solr.common.SolrInputD
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.util.ExternalPaths;
-import org.junit.Test;
 
 
 /**
@@ -66,8 +65,8 @@ public abstract class MultiCoreExampleTe
   protected abstract SolrServer getSolrCore1();
   protected abstract SolrServer getSolrAdmin();
   protected abstract SolrServer getSolrCore(String name);
+  
 
-  @Test
   public void testMultiCore() throws Exception
   {
     UpdateRequest up = new UpdateRequest();
@@ -80,8 +79,6 @@ public abstract class MultiCoreExampleTe
     // Add something to each core
     SolrInputDocument doc = new SolrInputDocument();
     doc.setField( "id", "AAA" );
-    doc.setField( "name", "AAA1" );
-    doc.setField( "type", "BBB1" );
     doc.setField( "core0", "yup" );
    
     // Add to core0
@@ -99,8 +96,6 @@ public abstract class MultiCoreExampleTe
 
     // Add to core1
     doc.setField( "id", "BBB" );
-    doc.setField( "name", "BBB1" );
-    doc.setField( "type", "AAA1" );
     doc.setField( "core1", "yup" );
     doc.removeField( "core0" );
     up.add( doc );
@@ -129,12 +124,6 @@ public abstract class MultiCoreExampleTe
     assertEquals( 0, getSolrCore1().query( new SolrQuery( "id:AAA" ) ).getResults().size() );
     assertEquals( 1, getSolrCore1().query( new SolrQuery( "id:BBB" ) ).getResults().size() );
 
-    // cross-core join
-    assertEquals( 0, getSolrCore0().query( new SolrQuery( "{!join from=type to=name}*:*" ) ).getResults().size() );  // normal join
-    assertEquals( 1, getSolrCore0().query( new SolrQuery( "{!join from=type to=name fromIndex=core1}id:BBB" ) ).getResults().size() );
-    assertEquals( 1, getSolrCore1().query( new SolrQuery( "{!join from=type to=name fromIndex=core0}id:AAA" ) ).getResults().size() );
-
-
     // Now test reloading it should have a newer open time
     String name = "core0";
     SolrServer coreadmin = getSolrAdmin();