: According to an existing test this should work:
: 
https://github.com/apache/solr/blob/ac3d349dac530cf1001d5113fc21b0fd641cc9d5/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java#L1494

FWIW: The Lucene HNSW/vector based queries do some very weird non-standard 
thigs in their rewrite() methods, which certainly make it plausale that 
the SOlr QueryEqualityTests might pass, but some "real world" usage might 
not cache properly.

having said that...

I tried recreating the problem described using a minimal viable manual 
test -- i happened to use 9.6.1 because i already had it running with a 
trivial vector field...

<fieldType name="knn_vector" class="solr.DenseVectorField" vectorDimension="4" 
similarityFunction="cosine"/>
<field name="vector" type="knn_vector" indexed="true" stored="true"/>

With this data...

curl -H "Content-Type: application/json" 
"http://localhost:8983/solr/techproducts/update?commit=true"; --data-binary 
'[{"id":"aaa","type_s":"xxx","vector":[1,2,3,4]},{"id":"bbb","type_s":"xxx","vector":[2,2,3,4]},{"id":"ccc","type_s":"yyy","vector":[1,2,3,5]}]'

Running this request and monitoring the cache metrics showed cache inserts 
on the fitlerCache (for the preFilter) and on the queryResultsCache (for 
the overall query) ...

curl 'http://localhost:8983/solr/techproducts/select' --form-string 'q={!bool 
should=$vectorQuery}' --form-string 'ectorQuery={!knn f=vector topK=3 
preFilter=$preFilter v=$vector}' --form-string 'preFilter=type_s:xxx' 
--form-string 'vector=[2,2,2,2]'

..re-running that exact curl command over and over again showed repeated 
cache hits from both caches (w/o any interstions)

So i echo Matthias's suspicion that maybe there is something about your 
particular "real world" situation that's causing the issue?

Can you provide us with detailed steps to reproduce? (exact configs, 
sample data to index, sample queries to run, waht metrics you are looking 
at that convince you the caching isn't working correctly, etc...)


-Hoss
http://www.lucidworks.com/

Reply via email to