# QueryParser in Lucene 5.5.0 not returning same results as in 4.10.4

**URL:** <https://discuss.elastic.co/t/queryparser-in-lucene-5-5-0-not-returning-same-results-as-in-4-10-4/58127>\
**Category:** Elasticsearch\
**Created:** [August 16, 2016, 11:59am UTC](https://discuss.elastic.co/t/queryparser-in-lucene-5-5-0-not-returning-same-results-as-in-4-10-4/58127 "2016-08-16T11:59:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moshe\_Sucaz](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@Moshe\_Sucaz](https://discuss.elastic.co/u/Moshe_Sucaz)\
**Post date:** [August 16, 2016, 11:59am UTC](https://discuss.elastic.co/t/queryparser-in-lucene-5-5-0-not-returning-same-results-as-in-4-10-4/58127/1 "2016-08-16T11:59:06Z")

</div>

Hi,  
I am upgrading our elastic 1.5.2 with lucene 4.10.4 to elastic 2.3 with lucene 5.5.0.

when searching for “hello world” in old system, I got only documents with the exact phrase “hello world”, while in the new one I get also documents with “hello” and/or “world”.

While debugging I saw that the problematic line is:  
final Query luceneQuery = qp.parse(queryString); \*

In the old system, luceneQuery value after this line is:  
\_field:"hello world"  
and later the query was:  
{"query\_string":{"query":""hello world"","fields":["title","topic"],"use\_dis\_max":false,"analyzer":"hebrew\_query\_light"}}

In the new system, its:  
\_field:"(hello$ hello) (world$ world)"  
later on, the query is:  
{"bool":{"must":{"multi\_match":{"query":""(hello$ hello) (world$ world)"","fields":["title.hebrew\_query\_light","topic.hebrew\_query\_light"]}}}}

How can I force QueryParser to be \_field:"hello world"?

- Taken from next lines:  
String parsingDummyFieldName = "\_field";  
final Map\<String, Analyzer\> analyzerMap = new HashMap\<\>(3);  
hebrewAnalyzer = new HebrewQueryAnalyzer(DictReceiver.getDictionary());  
analyzerMap.put("title", hebrewAnalyzer);  
analyzerMap.put("topic", hebrewAnalyzer);  
analyzerMap.put(parsingDummyFieldName, hebrewAnalyzer);  
perFieldAnalyzerWrapper = new PerFieldAnalyzerWrapper(new KeywordAnalyzer(), analyzerMap);  
org.apache.lucene.queryparser.classic.QueryParser qp = new org.apache.lucene.queryparser.classic.QueryParser(  
parsingDummyFieldName, perFieldAnalyzerWrapper);  
qp.setDefaultOperator(org.apache.lucene.queryparser.classic.QueryParser.Operator.AND);  
qp.setAllowLeadingWildcard(false);

QueryBuilder queryBuilder;  
final Query luceneQuery = qp.parse(queryString);

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:27pm UTC](https://discuss.elastic.co/t/queryparser-in-lucene-5-5-0-not-returning-same-results-as-in-4-10-4/58127/2 "2017-07-05T22:27:24Z")

</div>

Closed on July 5, 2017, 10:27pm UTC


