I am experimenting with the SOLR vector search feature (running version 0.9.4) and observing inconsistencies when using the KNN query parser alone or within a function query.
I have configured a vector field and indexed my documents.
a) Basic KNN query
Running the following simple KNN query works as expected :
q={!knn f=vector_field topK=3}[.. vector here ...]
I obtain 3 results ranked by decreasing cosine similarity.
b) Combining KNN with a function query
Next I would like to combine the knn search with a function query, in order to boost some of the documents.
To keep it simple here I just multiply the vector score with a constant of 1 :
q={!func}product(1,$subQuery)&
subQuery={!knn f=vector_field topK=3}[.. vector here ...]
I would expect the same results as before.
Instead, I get random documents, all having a score of zero.
This is the explain statement for the first match :
0.0 = product(const(1),query(KnnFloatVectorQuery:vector_field[-0.080,...] 3],def=0.0)=0.0) 1.0 = boost
If I increase topK, at some point I start getting back the results of the original KNN query, with non-zero scores.
I have not found any documentation regarding the compatibility of the KNN parser with function queries.
Has anyone experimented with this?