lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergiu Gordea <gser...@ifit.uni-klu.ac.at>
Subject MultifieldQueryParser.parse()
Date Tue, 06 Jul 2004 08:09:00 GMT

Hi all,

 I have a question,

 I have an index with more fileds and I have to create conjunctive 
queries by default.
So what I'm trying to say is that we develop a project and we provide 
search functionality
basing on lucene indexer.

 From what I can see, Multifield query parser creates disjunctive queries:
if I search for "best test" in fields {title, description} the

MultiFieldQueryParser.parse(string, fields, analizer)

will create a query that will mean "fields contain 'best' OR fileds 
contain 'test'" [1]
by I want to create "fields contain 'best' AND fileds contain 'test'"[2]
I know, I can place a + before each of this terms, but we also want to 
let the users to create
custom queries using logical operators and + -, grouping and exact phrases.

So in this situation we have to parse the query string twice wit the 
only change that we will ad AND operator to
link the TERMS in the places were no operator is found.

This seems to me to be just overhead, and I think that tha best way 
would be to overload parse function to

MultiFieldQueryParser.parse(String queryString, String[] fields, 
Analizer analizer, String/int defaultoperator)[3]
were default operator can be "AND" or "OR"
so that I can choose if I want to create query [1] or query [2].

 Do we have an alternative solution, reasonably simple for this problem?
What do you think about my suggestion of implementing the [3] method .


 Thanks for understanding,

  Sergiu



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message