Trouble with constructing BooleanQuery #19
joshuaMarkMuller
started this conversation in
General
Replies: 1 comment 2 replies
-
I'm not sure what In []: from lupyne import engine
In []: Q = engine.Query
In []: searchTerm = 'search term'
In []: Q.boost(Q.term('text1', searchTerm), 2.0) | Q.boost(Q.phrase('text1', searchTerm.split(' ')), 1.5) | Q.fuzzy('text1', searchTerm, 1)
Out[]: <BooleanQuery: ((text1:search term)^2.0 (text1:"(search term)")^1.5) text1:search term~1> |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been tasked to replicate a specific preexisting Lucene search. Currently I can create most of the original Lucene query however I'm having issues constructing the BooleanQuery object.
Currently I'm trying to construct the query this way:
q1 = Boost(Q.term('text1', searchTerm), value = 2)| Boost(Q.phrase('text1', searchTerm.split(' ')), value = 1.5)| Fuzzy('text1', searchTerm, 1)
q2 = Boost(Q.term('text2', searchTerm), value = 2)| Boost(Q.phrase('text2', searchTerm.split(' ')), value = 1.5)| Fuzzy('text2', searchTerm, 1)
query = q1 + q2
Is this formatting possible with Lupyne?
If not, is it possible to create a query from a raw Lucene query syntax as a string?
Beta Was this translation helpful? Give feedback.
All reactions