Files
documentdb/pg_helio_api/include/metadata
Zinan Ren 🐾 1222508d23 Merged PR 1485084: [Vector Search][DiskANN] Re-order search results after filtering
### Does this PR have any customer impact?
Yes

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No

### Are you introducing any new config? If yes, do you have tests with and without them being set?
No

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
The results of vector search + filtering on the DiskANN index might become unordered after iterative searches. It's necessary to re-order the results.

Adds a wrapper select query to the join query and re-order by the orderVar.
To force the planner to re-order the query,

`SELECT document FROM (JOIN c1 ON c1.ctid = c2.ctid limit k) ORDER BY c1.orderVal + 0`

----
#### AI description  (iteration 1)
#### PR Classification
Enhancement to re-order search results after filtering in vector search using DiskANN.

#### PR Summary
This pull request introduces a mechanism to re-order search results after applying filters in vector search using DiskANN.
- `src/aggregation/bson_aggregation_vector_search.c`: Added a new function `ReorderQueryResults` to wrap the join query and re-order results by a specified variable.
- `src/test/regress/expected/bson_aggregation_pipeline_tests_vector_diskann.out`: Updated expected output to reflect the new query structure and re-ordering logic.
2024-10-17 11:43:08 +03:00
..
2024-01-12 19:10:20 +00:00