mirror of https://github.com/apache/lucene.git
fix nocommits
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1441181 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ebf3b9432b
commit
d878a6eaf5
|
@ -250,7 +250,7 @@ class Lucene42DocValuesProducer extends DocValuesProducer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int lookupTerm(BytesRef key, BytesRef spare) {
|
||||
public int lookupTerm(BytesRef key) {
|
||||
try {
|
||||
InputOutput<Long> o = fstEnum.seekCeil(key);
|
||||
if (o == null) {
|
||||
|
|
|
@ -95,8 +95,8 @@ public abstract class SortedDocValues extends BinaryDocValues {
|
|||
// nocommit: what does spare mean? its no spare: because people rely upon its return value!
|
||||
// if its 'result' then the parameter and javadoc needs changing, otherwise things need fixing
|
||||
// unconditionally set its value to "NONSENSE" bytes to see the bugs!
|
||||
public int lookupTerm(BytesRef key, BytesRef spare) {
|
||||
|
||||
public int lookupTerm(BytesRef key) {
|
||||
BytesRef spare = new BytesRef();
|
||||
int low = 0;
|
||||
int high = getValueCount()-1;
|
||||
|
||||
|
|
|
@ -38,11 +38,11 @@ public class SortedDocValuesTermsEnum extends TermsEnum {
|
|||
|
||||
@Override
|
||||
public SeekStatus seekCeil(BytesRef text, boolean useCache /* ignored */) throws IOException {
|
||||
int ord = values.lookupTerm(text, term);
|
||||
int ord = values.lookupTerm(text);
|
||||
if (ord >= 0) {
|
||||
currentOrd = ord;
|
||||
term.offset = 0;
|
||||
// nocommit is there cleaner way ...
|
||||
// TODO: is there a cleaner way?
|
||||
// term.bytes may be pointing to codec-private byte[]
|
||||
// storage, so we must force new byte[] allocation:
|
||||
term.bytes = new byte[text.length];
|
||||
|
@ -62,7 +62,7 @@ public class SortedDocValuesTermsEnum extends TermsEnum {
|
|||
|
||||
@Override
|
||||
public boolean seekExact(BytesRef text, boolean useCache) throws IOException {
|
||||
int ord = values.lookupTerm(text, term);
|
||||
int ord = values.lookupTerm(text);
|
||||
if (ord >= 0) {
|
||||
currentOrd = ord;
|
||||
return true;
|
||||
|
|
|
@ -91,9 +91,8 @@ public abstract class FieldCacheRangeFilter<T> extends Filter {
|
|||
@Override
|
||||
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
|
||||
final SortedDocValues fcsi = FieldCache.DEFAULT.getTermsIndex(context.reader(), field);
|
||||
final BytesRef spare = new BytesRef();
|
||||
final int lowerPoint = lowerVal == null ? -1 : fcsi.lookupTerm(new BytesRef(lowerVal), spare);
|
||||
final int upperPoint = upperVal == null ? -1 : fcsi.lookupTerm(new BytesRef(upperVal), spare);
|
||||
final int lowerPoint = lowerVal == null ? -1 : fcsi.lookupTerm(new BytesRef(lowerVal));
|
||||
final int upperPoint = upperVal == null ? -1 : fcsi.lookupTerm(new BytesRef(upperVal));
|
||||
|
||||
final int inclusiveLowerPoint, inclusiveUpperPoint;
|
||||
|
||||
|
@ -149,9 +148,8 @@ public abstract class FieldCacheRangeFilter<T> extends Filter {
|
|||
@Override
|
||||
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
|
||||
final SortedDocValues fcsi = FieldCache.DEFAULT.getTermsIndex(context.reader(), field);
|
||||
final BytesRef spare = new BytesRef();
|
||||
final int lowerPoint = lowerVal == null ? -1 : fcsi.lookupTerm(lowerVal, spare);
|
||||
final int upperPoint = upperVal == null ? -1 : fcsi.lookupTerm(upperVal, spare);
|
||||
final int lowerPoint = lowerVal == null ? -1 : fcsi.lookupTerm(lowerVal);
|
||||
final int upperPoint = upperVal == null ? -1 : fcsi.lookupTerm(upperVal);
|
||||
|
||||
final int inclusiveLowerPoint, inclusiveUpperPoint;
|
||||
|
||||
|
|
|
@ -121,9 +121,8 @@ public class FieldCacheTermsFilter extends Filter {
|
|||
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
|
||||
final SortedDocValues fcsi = getFieldCache().getTermsIndex(context.reader(), field);
|
||||
final FixedBitSet bits = new FixedBitSet(fcsi.getValueCount());
|
||||
final BytesRef spare = new BytesRef();
|
||||
for (int i=0;i<terms.length;i++) {
|
||||
int ord = fcsi.lookupTerm(terms[i], spare);
|
||||
int ord = fcsi.lookupTerm(terms[i]);
|
||||
if (ord >= 0) {
|
||||
bits.set(ord);
|
||||
}
|
||||
|
|
|
@ -1130,7 +1130,7 @@ public abstract class FieldComparator<T> {
|
|||
bottomSameReader = true;
|
||||
readerGen[bottomSlot] = currentReaderGen;
|
||||
} else {
|
||||
final int index = termsIndex.lookupTerm(bottomValue, tempBR);
|
||||
final int index = termsIndex.lookupTerm(bottomValue);
|
||||
if (index < 0) {
|
||||
bottomOrd = -index - 2;
|
||||
bottomSameReader = false;
|
||||
|
|
|
@ -284,7 +284,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
|||
if (collectedGroup.groupValue == null) {
|
||||
ord = -1;
|
||||
} else {
|
||||
ord = groupIndex.lookupTerm(collectedGroup.groupValue, scratchBytesRef);
|
||||
ord = groupIndex.lookupTerm(collectedGroup.groupValue);
|
||||
}
|
||||
if (collectedGroup.groupValue == null || ord >= 0) {
|
||||
ordSet.put(ord);
|
||||
|
@ -298,7 +298,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
|||
if (collectedGroup.sortValues[i] == null) {
|
||||
sortOrd = -1;
|
||||
} else {
|
||||
sortOrd = sortsIndex[i].lookupTerm(collectedGroup.sortValues[i], scratchBytesRef);
|
||||
sortOrd = sortsIndex[i].lookupTerm(collectedGroup.sortValues[i]);
|
||||
}
|
||||
collectedGroup.sortOrds[i] = sortOrd;
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
|||
if (collectedGroup.groupValue == null) {
|
||||
groupOrd = -1;
|
||||
} else {
|
||||
groupOrd = groupIndex.lookupTerm(collectedGroup.groupValue, scratchBytesRef);
|
||||
groupOrd = groupIndex.lookupTerm(collectedGroup.groupValue);
|
||||
}
|
||||
if (collectedGroup.groupValue == null || groupOrd >= 0) {
|
||||
ordSet.put(groupOrd);
|
||||
|
@ -459,7 +459,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
|||
if (collectedGroup.sortOrds[i] == -1) {
|
||||
sortOrd = -1;
|
||||
} else {
|
||||
sortOrd = sortsIndex[i].lookupTerm(collectedGroup.sortValues[i], scratchBytesRef);
|
||||
sortOrd = sortsIndex[i].lookupTerm(collectedGroup.sortValues[i]);
|
||||
}
|
||||
collectedGroup.sortOrds[i] = sortOrd;
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
|||
if (collectedGroup.groupValue == null) {
|
||||
ord = -1;
|
||||
} else {
|
||||
ord = groupIndex.lookupTerm(collectedGroup.groupValue, scratchBytesRef);
|
||||
ord = groupIndex.lookupTerm(collectedGroup.groupValue);
|
||||
}
|
||||
if (collectedGroup.groupValue == null || ord >= 0) {
|
||||
ordSet.put(ord);
|
||||
|
|
|
@ -53,7 +53,6 @@ public class TermAllGroupsCollector extends AbstractAllGroupsCollector<BytesRef>
|
|||
private final List<BytesRef> groups;
|
||||
|
||||
private SortedDocValues index;
|
||||
private final BytesRef spareBytesRef = new BytesRef();
|
||||
|
||||
/**
|
||||
* Expert: Constructs a {@link AbstractAllGroupsCollector}
|
||||
|
@ -113,7 +112,7 @@ public class TermAllGroupsCollector extends AbstractAllGroupsCollector<BytesRef>
|
|||
if (countedGroup == null) {
|
||||
ordSet.put(-1);
|
||||
} else {
|
||||
int ord = index.lookupTerm(countedGroup, spareBytesRef);
|
||||
int ord = index.lookupTerm(countedGroup);
|
||||
if (ord >= 0) {
|
||||
ordSet.put(ord);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ public class TermDistinctValuesCollector extends AbstractDistinctValuesCollector
|
|||
private final List<GroupCount> groups;
|
||||
private final SentinelIntSet ordSet;
|
||||
private final GroupCount groupCounts[];
|
||||
private final BytesRef spare = new BytesRef();
|
||||
|
||||
private SortedDocValues groupFieldTermIndex;
|
||||
private SortedDocValues countFieldTermIndex;
|
||||
|
@ -109,9 +108,8 @@ public class TermDistinctValuesCollector extends AbstractDistinctValuesCollector
|
|||
groupFieldTermIndex = FieldCache.DEFAULT.getTermsIndex(context.reader(), groupField);
|
||||
countFieldTermIndex = FieldCache.DEFAULT.getTermsIndex(context.reader(), countField);
|
||||
ordSet.clear();
|
||||
BytesRef scratch = new BytesRef();
|
||||
for (GroupCount group : groups) {
|
||||
int groupOrd = group.groupValue == null ? -1 : groupFieldTermIndex.lookupTerm(group.groupValue, spare);
|
||||
int groupOrd = group.groupValue == null ? -1 : groupFieldTermIndex.lookupTerm(group.groupValue);
|
||||
if (group.groupValue != null && groupOrd < 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -121,7 +119,7 @@ public class TermDistinctValuesCollector extends AbstractDistinctValuesCollector
|
|||
Arrays.fill(group.ords, -2);
|
||||
int i = 0;
|
||||
for (BytesRef value : group.uniqueValues) {
|
||||
int countOrd = value == null ? -1 : countFieldTermIndex.lookupTerm(value, scratch);
|
||||
int countOrd = value == null ? -1 : countFieldTermIndex.lookupTerm(value);
|
||||
if (value == null || countOrd >= 0) {
|
||||
group.ords[i++] = countOrd;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
|||
|
||||
final List<GroupedFacetHit> groupedFacetHits;
|
||||
final SentinelIntSet segmentGroupedFacetHits;
|
||||
final BytesRef spare = new BytesRef();
|
||||
|
||||
SortedDocValues groupFieldTermsIndex;
|
||||
|
||||
|
@ -136,12 +135,12 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
|||
|
||||
segmentGroupedFacetHits.clear();
|
||||
for (GroupedFacetHit groupedFacetHit : groupedFacetHits) {
|
||||
int facetOrd = groupedFacetHit.facetValue == null ? -1 : facetFieldTermsIndex.lookupTerm(groupedFacetHit.facetValue, spare);
|
||||
int facetOrd = groupedFacetHit.facetValue == null ? -1 : facetFieldTermsIndex.lookupTerm(groupedFacetHit.facetValue);
|
||||
if (groupedFacetHit.facetValue != null && facetOrd < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int groupOrd = groupedFacetHit.groupValue == null ? -1 : groupFieldTermsIndex.lookupTerm(groupedFacetHit.groupValue, spare);
|
||||
int groupOrd = groupedFacetHit.groupValue == null ? -1 : groupFieldTermsIndex.lookupTerm(groupedFacetHit.groupValue);
|
||||
if (groupedFacetHit.groupValue != null && groupOrd < 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -151,14 +150,14 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
|||
}
|
||||
|
||||
if (facetPrefix != null) {
|
||||
startFacetOrd = facetFieldTermsIndex.lookupTerm(facetPrefix, spare);
|
||||
startFacetOrd = facetFieldTermsIndex.lookupTerm(facetPrefix);
|
||||
if (startFacetOrd < 0) {
|
||||
// Points to the ord one higher than facetPrefix
|
||||
startFacetOrd = -startFacetOrd - 1;
|
||||
}
|
||||
BytesRef facetEndPrefix = BytesRef.deepCopyOf(facetPrefix);
|
||||
facetEndPrefix.append(UnicodeUtil.BIG_TERM);
|
||||
endFacetOrd = facetFieldTermsIndex.lookupTerm(facetEndPrefix, spare);
|
||||
endFacetOrd = facetFieldTermsIndex.lookupTerm(facetEndPrefix);
|
||||
assert endFacetOrd < 0;
|
||||
endFacetOrd = -endFacetOrd - 1; // Points to the ord one higher than facetEndPrefix
|
||||
} else {
|
||||
|
@ -292,7 +291,7 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
|||
|
||||
segmentGroupedFacetHits.clear();
|
||||
for (GroupedFacetHit groupedFacetHit : groupedFacetHits) {
|
||||
int groupOrd = groupedFacetHit.groupValue == null ? -1 : groupFieldTermsIndex.lookupTerm(groupedFacetHit.groupValue, spare);
|
||||
int groupOrd = groupedFacetHit.groupValue == null ? -1 : groupFieldTermsIndex.lookupTerm(groupedFacetHit.groupValue);
|
||||
if (groupedFacetHit.groupValue != null && groupOrd < 0) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ public class TermSecondPassGroupingCollector extends AbstractSecondPassGroupingC
|
|||
|
||||
private final SentinelIntSet ordSet;
|
||||
private SortedDocValues index;
|
||||
private final BytesRef spareBytesRef = new BytesRef();
|
||||
private final String groupField;
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
|
@ -62,7 +61,7 @@ public class TermSecondPassGroupingCollector extends AbstractSecondPassGroupingC
|
|||
ordSet.clear();
|
||||
for (SearchGroupDocs<BytesRef> group : groupMap.values()) {
|
||||
// System.out.println(" group=" + (group.groupValue == null ? "null" : group.groupValue.utf8ToString()));
|
||||
int ord = group.groupValue == null ? -1 : index.lookupTerm(group.groupValue, spareBytesRef);
|
||||
int ord = group.groupValue == null ? -1 : index.lookupTerm(group.groupValue);
|
||||
if (group.groupValue == null || ord >= 0) {
|
||||
groupDocs[ordSet.put(ord)] = group;
|
||||
}
|
||||
|
|
|
@ -102,11 +102,9 @@ public abstract class DocTermsIndexDocValues extends FunctionValues {
|
|||
lowerVal = lowerVal == null ? null : toTerm(lowerVal);
|
||||
upperVal = upperVal == null ? null : toTerm(upperVal);
|
||||
|
||||
final BytesRef spare = new BytesRef();
|
||||
|
||||
int lower = Integer.MIN_VALUE;
|
||||
if (lowerVal != null) {
|
||||
lower = termsIndex.lookupTerm(new BytesRef(lowerVal), spare);
|
||||
lower = termsIndex.lookupTerm(new BytesRef(lowerVal));
|
||||
if (lower < 0) {
|
||||
lower = -lower-1;
|
||||
} else if (!includeLower) {
|
||||
|
@ -116,7 +114,7 @@ public abstract class DocTermsIndexDocValues extends FunctionValues {
|
|||
|
||||
int upper = Integer.MAX_VALUE;
|
||||
if (upperVal != null) {
|
||||
upper = termsIndex.lookupTerm(new BytesRef(upperVal), spare);
|
||||
upper = termsIndex.lookupTerm(new BytesRef(upperVal));
|
||||
if (upper < 0) {
|
||||
upper = -upper-2;
|
||||
} else if (!includeUpper) {
|
||||
|
|
|
@ -445,13 +445,11 @@ public class AssertingAtomicReader extends FilterAtomicReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int lookupTerm(BytesRef key, BytesRef spare) {
|
||||
public int lookupTerm(BytesRef key) {
|
||||
assert key.isValid();
|
||||
assert spare.isValid();
|
||||
int result = in.lookupTerm(key, spare);
|
||||
int result = in.lookupTerm(key);
|
||||
assert result < valueCount;
|
||||
assert key.isValid();
|
||||
assert spare.isValid();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1067,7 +1067,7 @@ public abstract class BaseDocValuesFormatTestCase extends LuceneTestCase {
|
|||
hash.get(sort[i], expected);
|
||||
docValues.lookupOrd(i, actual);
|
||||
assertEquals(expected.utf8ToString(), actual.utf8ToString());
|
||||
int ord = docValues.lookupTerm(expected, actual);
|
||||
int ord = docValues.lookupTerm(expected);
|
||||
assertEquals(i, ord);
|
||||
}
|
||||
AtomicReader slowR = SlowCompositeReaderWrapper.wrap(reader);
|
||||
|
|
|
@ -242,11 +242,11 @@ class PerSegmentSingleValuedFaceting {
|
|||
|
||||
if (prefix!=null) {
|
||||
BytesRef prefixRef = new BytesRef(prefix);
|
||||
startTermIndex = si.lookupTerm(prefixRef, tempBR);
|
||||
startTermIndex = si.lookupTerm(prefixRef);
|
||||
if (startTermIndex<0) startTermIndex=-startTermIndex-1;
|
||||
prefixRef.append(UnicodeUtil.BIG_TERM);
|
||||
// TODO: we could constrain the lower endpoint if we had a binarySearch method that allowed passing start/end
|
||||
endTermIndex = si.lookupTerm(prefixRef, tempBR);
|
||||
endTermIndex = si.lookupTerm(prefixRef);
|
||||
assert endTermIndex < 0;
|
||||
endTermIndex = -endTermIndex-1;
|
||||
} else {
|
||||
|
|
|
@ -480,6 +480,8 @@ public class SimpleFacets {
|
|||
|
||||
SortedDocValues si = FieldCache.DEFAULT.getTermsIndex(searcher.getAtomicReader(), fieldName);
|
||||
|
||||
final BytesRef br = new BytesRef();
|
||||
|
||||
final BytesRef prefixRef;
|
||||
if (prefix == null) {
|
||||
prefixRef = null;
|
||||
|
@ -490,14 +492,12 @@ public class SimpleFacets {
|
|||
prefixRef = new BytesRef(prefix);
|
||||
}
|
||||
|
||||
final BytesRef br = new BytesRef();
|
||||
|
||||
int startTermIndex, endTermIndex;
|
||||
if (prefix!=null) {
|
||||
startTermIndex = si.lookupTerm(prefixRef, br);
|
||||
startTermIndex = si.lookupTerm(prefixRef);
|
||||
if (startTermIndex<0) startTermIndex=-startTermIndex-1;
|
||||
prefixRef.append(UnicodeUtil.BIG_TERM);
|
||||
endTermIndex = si.lookupTerm(prefixRef, br);
|
||||
endTermIndex = si.lookupTerm(prefixRef);
|
||||
assert endTermIndex < 0;
|
||||
endTermIndex = -endTermIndex-1;
|
||||
} else {
|
||||
|
|
|
@ -203,7 +203,7 @@ class TermOrdValComparator_SML extends FieldComparator<Comparable> {
|
|||
bottomSameReader = true;
|
||||
readerGen[bottomSlot] = currentReaderGen;
|
||||
} else {
|
||||
final int index = termsIndex.lookupTerm(bottomValue, tempBR);
|
||||
final int index = termsIndex.lookupTerm(bottomValue);
|
||||
if (index < 0) {
|
||||
bottomOrd = -index - 2;
|
||||
bottomSameReader = false;
|
||||
|
|
Loading…
Reference in New Issue