Re: How to filter KnnVectorQuery with multiple terms?

2022-08-31 Thread Michael Wechner
great, thank you very much for clarifying! Michael Am 01.09.22 um 08:43 schrieb Uwe Schindler: Simply said, the last parameter of KnnVectorQuery is a Lucene query, so you can pass any query type there. TermInSetQuery is a good idea for doing a "IN multiple terms" query. But you can also pass

Re: How to filter KnnVectorQuery with multiple terms?

2022-08-31 Thread Uwe Schindler
Simply said, the last parameter of KnnVectorQuery is a Lucene query, so you can pass any query type there. TermInSetQuery is a good idea for doing a "IN multiple terms" query. But you can also pass a BooleanQuery with multiple terms or a combination of other queries, a numeric range,... or a

Re: How to filter KnnVectorQuery with multiple terms?

2022-08-31 Thread Michael Wechner
Hi Matt Thanks very much for your feedback! According to your links I will try Collection terms =new ArrayList(); terms.add(new BytesRef(classification1)); terms.add(new BytesRef(classification2)); Query filter =new TermInSetQuery(CLASSIFICATION_FIELD, terms); query =new KnnVectorQuery(VECTOR_

Re: How to filter KnnVectorQuery with multiple terms?

2022-08-31 Thread Matt Davis
If I understand correctly, I believe you would want to use a TermInSetQuery query. An example usage can be found here https://github.com/zuliaio/zuliasearch/blob/main/zulia-server/src/main/java/io/zulia/server/index/ZuliaIndex.java#L398. You can also check out the usage of KnnVectorQuery here: h

How to filter KnnVectorQuery with multiple terms?

2022-08-31 Thread Michael Wechner
Hi I am currently filtering a KnnVectorQuery as follows Query filter =new TermQuery(new Term(CLASSIFICATION_FIELD, classification)); query =new KnnVectorQuery(VECTOR_FIELD, queryVector, k, filter); but it is not clear to me how I can filter for multiple terms. Should I subclass MultiTermQuery