I am trying to create a query, that first will return a set of results, then
it will give a boost to the results that have all the keyword entered by the
user.


Ahmet Arslan wrote:
> 
> 
>> generate a query like the following:
>> title:(+chemistry +"national curriculum")
> 
> I didn't understand what exactly you are asking but the query string is
> already well-formatted. You can pass this string directly to the parse
> method of QueryParser. The following four examples yields the same Query
> object.
> 
> String[] ar = {"title:(+chemistry +\"national curriculum\")"};
> org.apache.lucene.queryParser.QueryParser.main(ar);
> 
> String[] ar1 = {"title:(chemistry AND \"national curriculum\")"};
> org.apache.lucene.queryParser.QueryParser.main(ar1);
> 
> QueryParser qp = new QueryParser("title", new StandardAnalyzer());
> Query q = qp.parse("chemistry AND \"national curriculum\"");
> System.out.println(q.toString());
> 
> qp.setDefaultOperator(QueryParser.AND_OPERATOR);
> q = qp.parse("chemistry \"national curriculum\"");
> System.out.println(q.toString());
> 
>> its mention that it can be done using the QueryParser but
>> unfortunately I can't find any reference in how to used it. 
> 
> http://lucene.apache.org/java/2_4_1/queryparsersyntax.html
> Just prepare a String according to descriptions in here, and pass it to
> the parse method of QueryParser.
> 
> 
> 
>       
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Generating-Query-for-Multiple-Clauses-in-a-Single-Field-tp24694748p24733084.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to