Skip to content

Commit

Permalink
apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bugmakerrrrrr committed Oct 29, 2024
1 parent 355e57c commit e3fdaa1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ Optimizations
* GITHUB#13943: Removed shared `HitsThresholdChecker`, which reduces overhead
but may delay a bit when dynamic pruning kicks in. (Adrien Grand)

* GITHUB#13961: Replace Map<String,Object> with IntObjectHashMap for DV producer. (Pan Guixin)

Bug Fixes
---------------------
* GITHUB#13832: Fixed an issue where the DefaultPassageFormatter.format method did not format passages as intended
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.lucene.codecs.DocValuesProducer;
import org.apache.lucene.codecs.FieldsProducer;
Expand All @@ -32,7 +34,6 @@
import org.apache.lucene.codecs.TermVectorsReader;
import org.apache.lucene.index.MultiDocValues.MultiSortedDocValues;
import org.apache.lucene.index.MultiDocValues.MultiSortedSetDocValues;
import org.apache.lucene.internal.hppc.IntObjectHashMap;
import org.apache.lucene.search.KnnCollector;
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Bits;
Expand Down Expand Up @@ -376,7 +377,7 @@ private static class SlowCompositeDocValuesProducerWrapper extends DocValuesProd
private final CodecReader[] codecReaders;
private final DocValuesProducer[] producers;
private final int[] docStarts;
private final IntObjectHashMap<OrdinalMap> cachedOrdMaps = new IntObjectHashMap<>();
private final Map<String, OrdinalMap> cachedOrdMaps = new HashMap<>();

SlowCompositeDocValuesProducerWrapper(CodecReader[] codecReaders, int[] docStarts) {
this.codecReaders = codecReaders;
Expand Down Expand Up @@ -415,14 +416,14 @@ public BinaryDocValues getBinary(FieldInfo field) throws IOException {
public SortedDocValues getSorted(FieldInfo field) throws IOException {
OrdinalMap map = null;
synchronized (cachedOrdMaps) {
map = cachedOrdMaps.get(field.number);
map = cachedOrdMaps.get(field.name);
if (map == null) {
// uncached, or not a multi dv
SortedDocValues dv =
MultiDocValues.getSortedValues(new MultiReader(codecReaders), field.name);
if (dv instanceof MultiSortedDocValues) {
map = ((MultiSortedDocValues) dv).mapping;
cachedOrdMaps.put(field.number, map);
cachedOrdMaps.put(field.name, map);
}
return dv;
}
Expand Down Expand Up @@ -451,14 +452,14 @@ public SortedNumericDocValues getSortedNumeric(FieldInfo field) throws IOExcepti
public SortedSetDocValues getSortedSet(FieldInfo field) throws IOException {
OrdinalMap map = null;
synchronized (cachedOrdMaps) {
map = cachedOrdMaps.get(field.number);
map = cachedOrdMaps.get(field.name);
if (map == null) {
// uncached, or not a multi dv
SortedSetDocValues dv =
MultiDocValues.getSortedSetValues(new MultiReader(codecReaders), field.name);
if (dv instanceof MultiSortedSetDocValues) {
map = ((MultiSortedSetDocValues) dv).mapping;
cachedOrdMaps.put(field.number, map);
cachedOrdMaps.put(field.name, map);
}
return dv;
}
Expand Down

0 comments on commit e3fdaa1

Please sign in to comment.