lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kelvin Tan <>
Subject Re: Having common word in the search
Date Mon, 02 Aug 2004 08:23:44 GMT
I think the answer really really depends on the query input source, and 

If the source is a web-based form AND users only enter "basic" searches, then 
lucenequeryconstructor.js in sandbox does an adequate job of building complex 
queries from a simple form. Alternatively, just use javascript to modify the 
query before form submission.

In any event, many people seem to miss the second parse method in 
ldQueryParser.html#parse(java.lang.String, java.lang.String[], int[], 

Still, the queries that can be constructed using MultiFieldQueryParser aren't 
complex, as compared to lucenequeryconstructor for instance.

On Mon, 2 Aug 2004 13:18:38 +0530, lingaraju said:
> Dear  All
> Searcher searcher = new IndexSearcher("C:/index");
> Analyzer analyzer = new StandardAnalyzer();
> String line="curry asia";
> line=line+"recipe";
> String fields[] = new String[2];
> fields[0] = "title";
> fields[1] = "contents";
> Query q = MultiFieldQueryParser.parse(line,fields,analyzer);
> Hits hits1 =;
> In the above code Hits will return the documnet  that contains
> the word
> 1)"Curry OR asia OR recipe"
> 2)"Curry OR asia AND recipe"
> 3)"Curry AND asia AND recipe"
> 4)"Curry AND asia OR recipe"
> But I want the result should be
> Like this
> 1)"Curry AND asia AND recipe"
> 2)("Curry OR asia) AND recipe"
> My question is how to give the condition
> Actually my requirement is like this
> User will enter some text in "text box" it may be one word or two word or n 
word.(Eg "curry asia")
> but when i am searching i will append "recipe" word in the search string so 
the search must
> contains "recipe"  word.
> Finally search should contains
> 1)"Curry AND asia AND recipe"
> 2)("Curry OR asia) AND recipe"
> search should not contains
> 1)"Curry AND asia OR recipe"
> 2)"Curry OR asia OR recipe"
> Thanks and regards
> Raju

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message