Package org.apache.solr.search
Class SortedIntDocSet
java.lang.Object
org.apache.solr.search.DocSet
org.apache.solr.search.SortedIntDocSet
- All Implemented Interfaces:
Cloneable,org.apache.lucene.util.Accountable
A simple sorted int[] array implementation of
DocSet, good for small sets.-
Field Summary
FieldsFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAllTo(org.apache.lucene.util.FixedBitSet target) Adds all the docs from this set to the target.static intandNot(int[] a, int lena, int[] b, int lenb, int[] target) puts the intersection of a and not b into the target array and returns the sizeReturns the documents in this set that are not in the other set.protected static intandNotBinarySearch(int[] a, int lena, int[] b, int lenb, int[] target) clone()booleanexists(int doc) Returns true if a document is in the DocSet.org.apache.lucene.util.BitsgetBits()ABitsthat has fast random access (as is generally required of Bits).Collection<org.apache.lucene.util.Accountable> int[]getDocs()protected org.apache.lucene.util.FixedBitSetprotected org.apache.lucene.util.FixedBitSetstatic intintersection(int[] a, int lena, int[] b, int lenb, int[] target) puts the intersection of a and b into the target array and returns the sizeintersection(DocSet other) Returns the intersection of this set with another set.protected static intintersectionBinarySearch(int[] a, int lena, int[] b, int lenb, int[] target) Puts the intersection of a and b into the target array and returns the size.static intintersectionSize(int[] smallerSortedList, int[] biggerSortedList) intintersectionSize(DocSet other) Returns the number of documents of the intersection of this set with another set.static booleanintersects(int[] smallerSortedList, int[] biggerSortedList) booleanintersects(DocSet other) Returns true if these sets have any elements in commoniterator()Returns an ordered iterator of the documents in the set.org.apache.lucene.search.DocIdSetIteratoriterator(org.apache.lucene.index.LeafReaderContext context) Returns an ordered iterator of the documents in the set for the specifiedLeafReaderContext.org.apache.solr.search.DocSetQueryReturns a Query matching these documents with a score of 1.longstatic int[]shrink(int[] arr, int newSize) intsize()Returns the number of documents in the set.toString()Returns the union of this set with another set.Methods inherited from class org.apache.solr.search.DocSet
andNotSize, empty, unionSize
-
Field Details
-
docs
protected final int[] docs -
zeroInts
public static int[] zeroInts -
zero
-
-
Constructor Details
-
SortedIntDocSet
public SortedIntDocSet(int[] docs) - Parameters:
docs- Sorted list of ids
-
SortedIntDocSet
public SortedIntDocSet(int[] docs, int len) - Parameters:
docs- Sorted list of idslen- Number of ids in the list
-
-
Method Details
-
getDocs
public int[] getDocs() -
size
public int size()Description copied from class:DocSetReturns the number of documents in the set. -
shrink
public static int[] shrink(int[] arr, int newSize) -
intersectionSize
public static int intersectionSize(int[] smallerSortedList, int[] biggerSortedList) -
intersects
public static boolean intersects(int[] smallerSortedList, int[] biggerSortedList) -
intersectionSize
Description copied from class:DocSetReturns the number of documents of the intersection of this set with another set. May be more efficient than actually creating the intersection and then getting its size.- Specified by:
intersectionSizein classDocSet
-
intersects
Description copied from class:DocSetReturns true if these sets have any elements in common- Specified by:
intersectsin classDocSet
-
intersection
public static int intersection(int[] a, int lena, int[] b, int lenb, int[] target) puts the intersection of a and b into the target array and returns the size -
intersectionBinarySearch
protected static int intersectionBinarySearch(int[] a, int lena, int[] b, int lenb, int[] target) Puts the intersection of a and b into the target array and returns the size. lena should be smaller than lenb -
intersection
Description copied from class:DocSetReturns the intersection of this set with another set. Neither set is modified - a new DocSet is created and returned.- Specified by:
intersectionin classDocSet- Returns:
- a DocSet representing the intersection
-
andNotBinarySearch
protected static int andNotBinarySearch(int[] a, int lena, int[] b, int lenb, int[] target) -
andNot
public static int andNot(int[] a, int lena, int[] b, int lenb, int[] target) puts the intersection of a and not b into the target array and returns the size -
andNot
Description copied from class:DocSetReturns the documents in this set that are not in the other set. Neither set is modified - a new DocSet is created and returned. -
addAllTo
public void addAllTo(org.apache.lucene.util.FixedBitSet target) Description copied from class:DocSetAdds all the docs from this set to the target. The target should be sized large enough to accommodate all of the documents before calling this method. -
exists
public boolean exists(int doc) Description copied from class:DocSetReturns true if a document is in the DocSet. If you want to be guaranteed fast random access, useDocSet.getBits()instead. -
iterator
Description copied from class:DocSetReturns an ordered iterator of the documents in the set. Any scoring information is meaningless. -
getBits
public org.apache.lucene.util.Bits getBits()Description copied from class:DocSetABitsthat has fast random access (as is generally required of Bits). It may be necessary to do work to build this. -
getFixedBitSet
protected org.apache.lucene.util.FixedBitSet getFixedBitSet()- Specified by:
getFixedBitSetin classDocSet
-
getFixedBitSetClone
protected org.apache.lucene.util.FixedBitSet getFixedBitSetClone()- Specified by:
getFixedBitSetClonein classDocSet
-
union
Description copied from class:DocSetReturns the union of this set with another set. Neither set is modified - a new DocSet is created and returned. -
iterator
public org.apache.lucene.search.DocIdSetIterator iterator(org.apache.lucene.index.LeafReaderContext context) Description copied from class:DocSetReturns an ordered iterator of the documents in the set for the specifiedLeafReaderContext. NOTE: may return null if there are no matching documents for this leaf. -
makeQuery
public org.apache.solr.search.DocSetQuery makeQuery()Description copied from class:DocSetReturns a Query matching these documents with a score of 1. Note that DocSets do not refer to deleted docs. -
clone
-
ramBytesUsed
public long ramBytesUsed() -
getChildResources
-
toString
-