It is working but I come across another problem. I am expecting same
parsedquery in the following two approaches but I am not getting it as same
Approach 1:
BooleanQuery myQuery = new BooleanQuery();
myQuery.add(new TermQuery(new Term("PATIENT_GENDER", "Male")),
BooleanClause.Occur.SHOULD);
myQuery.add(new TermQuery(new Term("STUDY_DIVISION","\"Cancer
Center\"")),
BooleanClause.Occur.SHOULD);
System.out.println("parsedquery >>"+myQuery.toString());
output is
parsedquery >>PATIENT_GENDER:Male STUDY_DIVISION:"Cancer Center"
Approach 2:
String defaultField ="text";
String queryString = "PATIENT_GENDER:Male OR STUDY_DIVISION:\"Cancer
Center\"";
QueryParser qp = new QueryParser(Version.LUCENE_40, defaultField, new
StandardAnalyzer(Version.LUCENE_40));
System.out.println("querystring >>"+queryString);
Query q = qp.parse(queryString);
System.out.println("parsedquery >>"+q.toString());
output is
querystring >>PATIENT_GENDER:Male OR STUDY_DIVISION:"Cancer Center"
parsedquery >>PATIENT_GENDER:male STUDY_DIVISION:"cancer center"
In the Approach 2, the values are converted into lower case and due to that
I am not getting same results even though my querystring are same.
If I have some fq parameters (filter query), how I can parse the query for
lucene? Is there any place from where I can get more information about
these kind of programming? any book available?
-- Sabeer
--
View this message in context:
http://lucene.472066.n3.nabble.com/Getting-Lucense-Query-from-Solr-query-Or-converting-Solr-Query-to-Lucense-s-query-tp4031187p4038753.html
Sent from the Solr - User mailing list archive at Nabble.com.