Current Limitation
The Vector Stores API only supports basic comparison operators (eq
, ne
, gt
, gte
, lt
, lte
) and logical operators (and
, or
) for attribute filtering. This severely limits text-based filtering capabilities, particularly for multi-value string fields like author lists or categories.
Feature Request
Please implement string manipulation operators, particularly contains
, to enable more flexible text-based searches.
A contains
operator would allow filtering documents where a string attribute contains a specified substring:
{"type": "contains", "property": "authors", "value": "John Smith"}
Additional useful operators would include startswith
, endswith
, in
(for array matching), and potentially regex
support.
Impact
These enhancements would significantly improve search functionality for content management systems, research applications, and knowledge bases. Most critically, it would enable proper filtering of documents with multiple values in a single string field, such as co-authored papers or multi-category content.
Example Use Case
In our scientific document search application, we store documents with attributes including authors
that often list multiple researchers. Currently, we can only search for exact matches, making it impossible to find all papers by a specific researcher when they’ve collaborated with others. A contains
operator would solve this problem elegantly and match industry standards for search functionality.
Thank you for considering this enhancement.