Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Enhancements
### Bug Fixes
* Fix visited docs tracking that led to assertions on AbstractKnnVectorQuery side [238] (https://github.com/opensearch-project/opensearch-jvector/pull/238)
* Revert of support deletes for incremental insertion [240](https://github.com/opensearch-project/opensearch-jvector/pull/240)
### Infrastructure
* Upgrade Gradle to 9.2.0 [220] (https://github.com/opensearch-project/opensearch-jvector/pull/222)
* Add support for JDK25 [220] (https://github.com/opensearch-project/opensearch-jvector/pull/222)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ public GraphNodeIdToDocMap(IndexInput in) throws IOException {
for (int ord = 0; ord < size; ord++) {
final int docId = in.readVInt();
graphNodeIdsToDocIds[ord] = docId;
if (docId != -1) {
// ignore deleted documents
docIdsToGraphNodeIds[docId] = ord;
}
docIdsToGraphNodeIds[docId] = ord;
}
}

Expand All @@ -71,19 +68,18 @@ public GraphNodeIdToDocMap(int[] graphNodeIdsToDocIds) {
// We are going to assume that the number of ordinals is roughly the same as the number of documents in the segment, therefore,
// the mapping will not be sparse.
if (maxDocs < graphNodeIdsToDocIds.length) {
throw new IllegalStateException("Max docs " + maxDocs + " is less than the number of ordinals " + graphNodeIdsToDocIds.length);
}
if (maxDocId > graphNodeIdsToDocIds.length) {
log.warn(
"Max docs {} is less than the number of ordinals {}, this implies a lot of deleted documents. Or that some documents are missing vectors. Wasting a lot of memory",
maxDocs,
"Max doc id {} is greater than the number of ordinals {}, this implies a lot of deleted documents. Or that some documents are missing vectors. Wasting a lot of memory",
maxDocId,
graphNodeIdsToDocIds.length
);
}
this.docIdsToGraphNodeIds = new int[maxDocs];
Arrays.fill(this.docIdsToGraphNodeIds, -1); // -1 means no mapping to ordinal
for (int ord = 0; ord < graphNodeIdsToDocIds.length; ord++) {
// -1 means no mapping to docId since document was deleted
if (graphNodeIdsToDocIds[ord] == -1) {
continue;
}
this.docIdsToGraphNodeIds[graphNodeIdsToDocIds[ord]] = ord;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class JVectorFormat extends KnnVectorsFormat {
// Unfortunately, this can't be managed yet by the OpenSearch ThreadPool because it's not supporting {@link ForkJoinPool} types
public static final ForkJoinPool SIMD_POOL_MERGE = getPhysicalCoreExecutor();
public static final ForkJoinPool SIMD_POOL_FLUSH = getPhysicalCoreExecutor();
public static final ForkJoinPool PARALLELISM_POOL = ForkJoinPool.commonPool();

private final int maxConn;
private final int beamWidth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ public void search(String field, float[] target, KnnCollector knnCollector, Acce
if (acceptDocs == null) compatibleBits = ord -> true;
else {
Bits b = acceptDocs.bits();
compatibleBits = ord -> b == null
|| (jvectorLuceneDocMap.getLuceneDocId(ord) != -1 && b.get(jvectorLuceneDocMap.getLuceneDocId(ord)));
compatibleBits = ord -> b == null || b.get(jvectorLuceneDocMap.getLuceneDocId(ord));
}

try (var graphSearcher = new GraphSearcher(index)) {
Expand Down
Loading
Loading