manticoresoftware / manticoresearch-php

Official PHP client for Manticore Search
MIT License
167 stars 32 forks source link

KNN overwrite the query while it's not expected #200

Closed donhardman closed 6 months ago

donhardman commented 6 months ago

When we use the code

$client->index('test')->search("query term")->knn(...)

we expect to perform a hybrid search that combines vector and keyword searches.

However, due to the current implementation, we can't do this without directly manipulating internal classes to build our query.

I suggest we consider an approach where using knn extends the current query rather than altering it. If we need to make changes, we can always use the reset method.

sanikolaev commented 6 months ago

To make things clear, here's what it looks like in the JSON DSL https://manual.manticoresearch.com/dev/Searching/KNN?client=JSON#Filtering-KNN-vector-search-results

Nick-S-2018 commented 6 months ago

Done in https://github.com/manticoresoftware/manticoresearch-php/commit/6fbdaacd80a4ec82a51a66d72ce9c5f546c7ef69