Skip to content

Commit 44d5bfb

Browse files
committed
Gate hybrid collapse distinct-groups collection behind an opt-in index setting
Add index.neural_search.hybrid_collapse_distinct_groups_enabled (dynamic, default false). The default keeps the existing behavior of collecting the top-size documents per sub-query, preserving score parity with the same hybrid query without collapse. When enabled, HybridCollapsingTopGroupsCollector collects the top-size distinct groups per sub-query instead, so the response contains size groups whenever that many exist. Resolves #1947 Signed-off-by: Yasutaka Hisano <yasutennis713@gmail.com>
1 parent 16eac85 commit 44d5bfb

13 files changed

Lines changed: 2217 additions & 432 deletions

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111
- Add `model_selection` (language_option/model_type) parameter to semantic field to resolve the model id from cluster settings ([#1918](https://github.com/opensearch-project/neural-search/issues/1918))
1212

1313
### Bug Fixes
14-
* [Hybrid Query] Fix collapse dropping valid groups when one group owns multiple top-scoring documents on a shard ([#1947](https://github.com/opensearch-project/neural-search/issues/1947))
14+
* [Hybrid Query] Add opt-in index setting `index.neural_search.hybrid_collapse_distinct_groups_enabled` to make collapse return top-`size` distinct groups instead of deduplicated top-`size` documents ([#1947](https://github.com/opensearch-project/neural-search/issues/1947))
1515
* [Hybrid Query] Fix NoSuchElementException in hybrid query with sort/search_after when a shard returns no results ([#1939](https://github.com/opensearch-project/neural-search/pull/1939))
1616
* [SemanticHighlighter] Fix SemanticHighlighterExtBuilder.toXContent ([#1906](https://github.com/opensearch-project/neural-search/issues/1906)) (query-insights [#651](https://github.com/opensearch-project/query-insights/issues/651))
1717
* [Sparse ANN] Fold sparse vector tokens into the signed-short range (modulus 32768) so folded tokens are never sign-extended to a negative value when stored in short[] ([#1926](https://github.com/opensearch-project/neural-search/pull/1926))

src/main/java/org/opensearch/neuralsearch/plugin/NeuralSearch.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package org.opensearch.neuralsearch.plugin;
66

77
import static org.opensearch.neuralsearch.highlight.SemanticHighlightingConstants.HIGHLIGHTER_TYPE;
8+
import static org.opensearch.neuralsearch.settings.NeuralSearchSettings.HYBRID_COLLAPSE_DISTINCT_GROUPS_ENABLED;
89
import static org.opensearch.neuralsearch.settings.NeuralSearchSettings.HYBRID_COLLAPSE_DOCS_PER_GROUP_PER_SUBQUERY;
910
import static org.opensearch.neuralsearch.settings.NeuralSearchSettings.RERANKER_MAX_DOC_FIELDS;
1011
import static org.opensearch.neuralsearch.settings.NeuralSearchSettings.NEURAL_STATS_ENABLED;
@@ -376,6 +377,7 @@ public List<Setting<?>> getSettings() {
376377
NEURAL_STATS_ENABLED,
377378
SEMANTIC_INGEST_BATCH_SIZE,
378379
HYBRID_COLLAPSE_DOCS_PER_GROUP_PER_SUBQUERY,
380+
HYBRID_COLLAPSE_DISTINCT_GROUPS_ENABLED,
379381
SparseSettings.IS_SPARSE_INDEX_SETTING,
380382
NeuralSearchSettings.SPARSE_ALGO_PARAM_INDEX_THREAD_QTY_SETTING,
381383
NEURAL_CIRCUIT_BREAKER_LIMIT,

src/main/java/org/opensearch/neuralsearch/search/collector/HybridCollapsingTopDocsCollector.java

Lines changed: 201 additions & 250 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)