typesense icon indicating copy to clipboard operation
typesense copied to clipboard

fix(index): correct curation handling in group-by queries

Open tharropoulos opened this issue 8 months ago • 0 comments

TLDR

Fixes curated_topster initialization to properly handle group-by first pass.

Change Summary

Bug Fixes:

  1. In src/index.cpp:
    • Index::search(): Fixed curated_topster initialization on line 3447 to use is_group_by_first_pass parameter instead of hardcoded false
    • This ensures curated results are properly handled during the first pass of group-by operations

Test Coverage:

  1. In test/collection_override_test.cpp:
    • CurationWithGroupBy(): Added new test method to verify curation works correctly with group-by queries
    • Tests both regular search and group-by search scenarios with pinned documents
    • Validates that curated documents maintain their curated flag in grouped results

Context

The bug occurred when using curation (pinned documents) with group-by queries. The curated_topster was being initialized with false for the group-by first pass parameter, causing curated results to not be properly handled during grouped searches. This fix ensures that both the main topster and curated_topster use the same is_group_by_first_pass parameter, maintaining consistency in how results are processed and ensuring curated documents appear correctly in grouped search results.

PR Checklist

tharropoulos avatar Jun 12 '25 13:06 tharropoulos