f1d5bccf48
## Issue Closes #5915 ## Change `AbstractAzureCosmosDBNoSqlEmbeddingStore.search()` appended the metadata filter with `" AND"` and no `WHERE` keyword. `AzureCosmosDBNoSqlFilterMapper.map()` returns a predicate without a leading space, so the query read `... FROM c ANDc.category = "electronics" ORDER BY ...` and Cosmos DB rejected it. Every filtered vector search failed; unfiltered search was unaffected. ```java queryBuilder.append(" WHERE ").append(filterMapper.map(request.filter())); ``` The filter is the only predicate here, so this mirrors `findRelevantWithFullTextSearch`. The full-text methods use `" WHERE ("` because another predicate follows theirs; #5486 fixed those two and left `search()` unchanged. The new `AzureCosmosDbNoSqlSearchQueryTest` mocks `CosmosAsyncContainer` and captures the `SqlQuerySpec`, asserting the query text without Azure credentials. It covers the filtered case (`WHERE` present) and the unfiltered case (no `WHERE`). Reverting the production change makes the filtered test fail. Build notes (JDK 17): `mvn -pl langchain4j-azure-cosmos-nosql clean test` is green — 33 tests, 0 failures, 6 skipped (pre-existing `@EnabledIfEnvironmentVariable` tests). Spotless passes. The `*IT` classes need live Azure Cosmos DB credentials and were not run. ## General checklist - [X] There are no breaking changes (API, behaviour) - [X] I have added unit and/or integration tests for my change - [X] The tests cover both positive and negative cases - [X] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green - [ ] I have manually run all the unit and integration tests in the [core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core) and [main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j) modules, and they are all green <!-- N/A — change is confined to langchain4j-azure-cosmos-nosql and touches no core or main module code. --> - [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) <!-- N/A — docs are added after review, per the template note. --> - [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features) <!-- N/A — bug fix, not a feature. --> - [ ] I have added/updated [Spring Boot starter(s)](https://github.com/langchain4j/langchain4j-spring) (if applicable) <!-- N/A — no starter covers this store. --> <!-- "Checklist for adding new maven module" and "Checklist for adding new embedding store integration" omitted: this PR adds neither. --> ## Checklist for changing existing embedding store integration - [ ] I have manually verified that the `{NameOfIntegration}EmbeddingStore` works correctly with the data persisted using the latest released version of LangChain4j <!-- Not verified: requires a live Azure Cosmos DB account. The change only affects query text generation, not the persisted document format. -->