Repository navigation
Description
When a collection has multiple vector properties, users can select which one they want to search over via VectorSearchOptions. Currently, if the user doesn't select one, the first vector property defined in the schema definition is automatically selected.
The fact that the schema property order affects this is quite non-obvious when using the API: the schema definition is provided in a completely different place (startup) vs. the place where the search is taking place. The situation seems even worse when the schema definition is inferred from the CLR type (via the attributes): I suspect the order then depends on reflection order, which would mean that if a user moves properties around in their C# code, their search suddenly starts to return no results!
In other words, I suspect lots of users will fall into a pit of failure here, where they simply don't get the expected result because the wrong vector property gets silently selected for them.
Instead, I'd propose we simply throw if there are multiple candidate properties and the user hasn't explicitly selected one. The main problem here seems to be the breaking change with regards to the current behavior. I'd argue that this is quite a benign breaking change: although it's a runtime break (rather than compile-time), it's very fail-fast (any code doing search fails immediately), and our exception can very explicitly guide the user towards the mitigation ("please set the property name explicitly").
Note also that this would only affect people with multiple vector properties - if there's only a single vector property, users wouldn't be required to specify the property. I suspect this would greatly reduce the number of users affected by this change.
Note: the same problem exists in hybrid search with selecting the full-text property (and later, the sparse vector one). Whatever we decide above should probably be applied here as well.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsSprint: Done
Activity
[-].Net MEVD: consider throwing instead of automatically choosing the first property in the schema when one isn't specified by the user[/-][+][MEVD] Throwing instead of automatically choosing the first property in the schema when one isn't specified by the user[/+]