lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Pryor <>
Subject building a search query
Date Wed, 09 Jun 2004 21:37:28 GMT
I am working on a UI to allow a user to build a search query. The user
creates individual "clauses", each of which is basically a simple search
query. The user selects boolean operators (AND, OR, NOT), to connect these
clauses. When the user is finished constructing the search, there will be N
clauses and N-1 boolean connectors.


Each clause is backed by an object that knows how to generate a Lucene Query
from the clause. The objective is to combine the clauses and the boolean
operators into a BooleanQuery. 


What is the best way to programmatically make the final BooleanQuery object?
It seems there is a modeling mismatch: the user sees N clauses connected
with N-1 connectors, but the BooleanQuery will require N Querys with each
Query having its own required and prohibited flags set correctly.


I looked briefly at the QueryParser class - it appears to have logic to
bridge these two different ways of modeling complex queries (in the
addClause method). Is this the best approach? What have others done?




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