lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincenzo D'Amore" <>
Subject match in order
Date Sat, 04 Nov 2017 17:12:41 GMT

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

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,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message