Hi,

I have a field field1 where there are only pairs of terms, for example the
documents

doc1 { field1 : "A B", title : "Hello title 1" }
doc2 { field1 : "A C", title : "Hello title 2"  }
doc3 { field1 : "A D", title : "Hello title 3"  }
doc4 { field1 : "B D", title : "Hello title 4"  }

I have to boost the documents where there is a pair terms in the same order
used in the query:

To be clear, if I the user search four terms: X A B Y

I have to check they are in a field:

X near A, A near B,  B near Y:

I've implemented this problem using complexphrase:

bq={!complexphrase inOrder=true df=field1}("X A" OR "A B" OR "B Y")^10

What do you think of this solution? Is there another solution, may be using
a different query parser?

Trying another way, I've also used with surround query parser, but I think,
I was unable to write the query correctly, never matches.

bq={!surround}field1:(W(X, A) OR W(A,B) OR W(B, Y))^10

Not sure if this is the correct syntax, I've also not found enough
documentation that explaining.

Best regards,
Vincenzo

Reply via email to