Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python: Fixes to Cosmos DB NoSQL query syntax generation. (#10373)
### Motivation and Context Review information: 1. Why is this change required? There were several SQL query syntax generation issue for both text_search() and vectorized_search() methods 2. What problem does it solve? a) In `_build_where_clauses_from_filter()` the WHERE clause creation did not quote string values and did not properly handle list[] data model attribures, b) for `_build_vector_query()` method the WHERE clause was placed after the ORDER BY clause causing query syntax errors, c) for `_build_search_text_query()` method the data_model_definition items were not being interrogated, thus added `CONTAINS()` in the WHERE clause. 3. What scenario does it contribute to? The ability to use Azure Cosmos DB NoSQL for `text_search()` and `vectorized_search()`. 4. Issue resolution: #10368 ### Description The errors noted in the Issue and the bug fixes noted above correct the SQL query syntax generation for the `text_search()` and `vectorized_search()` methods and now produce accurate results for performing both types of queries with and without filters (aka WHERE clause). ### Contribution Checklist - ✅ The code builds clean without any errors or warnings - ✅ The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - ✅ All unit tests pass, and I have added new tests where possible - 🙏 I didn't break anyone 😄 --------- Co-authored-by: Evan Mattson <[email protected]>
- Loading branch information