# QueryParser.setAutoGeneratePhraseQueries()

**URL:** <https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464>\
**Category:** Elasticsearch\
**Created:** [May 24, 2011, 4:40am UTC](https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464 "2011-05-24T04:40:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iori](https://avatars.discourse-cdn.com/v4/letter/i/90db22/32.png) [@Iori](https://discuss.elastic.co/u/Iori)\
**Post date:** [May 24, 2011, 4:40am UTC](https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464/1 "2011-05-24T04:40:27Z")

</div>

Hi,

I wonder if QueryParser.setAutoGeneratePhraseQueries() is exposed through  
API.  
From Lucene 3.1, the default value of AutoGeneratePhraseQueries becomes  
"false" for some reason. It breaks CJK queries. To make CJK queries to work,  
we need to call QueryParser.setAutoGeneratePhraseQueries(true).

If it's not possible, can I open a ticket for it?

Thanks,  
Iori

---

<div class="post-metadata">

**Author:** ![Michael\_McCandless](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@Michael\_McCandless](https://discuss.elastic.co/u/Michael_McCandless)\
**Post date:** [May 24, 2011, 9:48am UTC](https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464/2 "2011-05-24T09:48:20Z")

</div>

I think setting this to "true" breaks CJK queries... eg see  
[http://markmail.org/thread/ww6mhfi3rfpngmc5](http://markmail.org/thread/ww6mhfi3rfpngmc5)

It was changed to "false" by default in Lucene (see  
[[LUCENE-2458] queryparser makes all CJK queries phrase queries regardless of analyzer - ASF JIRA](https://issues.apache.org/jira/browse/LUCENE-2458) ) to not break CJK  
queries.

But I agree this setting should be controllable via ES.

Mike

[http://blog.mikemccandless.com](http://blog.mikemccandless.com)

On Tue, May 24, 2011 at 12:40 AM, Iori [haseori@gmail.com](mailto:haseori@gmail.com) wrote:

> Hi,  
> I wonder if QueryParser.setAutoGeneratePhraseQueries() is exposed through  
> API.  
> From Lucene 3.1, the default value of AutoGeneratePhraseQueries becomes  
> "false" for some reason. It breaks CJK queries. To make CJK queries to work,  
> we need to call QueryParser.setAutoGeneratePhraseQueries(true).  
> If it's not possible, can I open a ticket for it?
> 
> Thanks,  
> Iori

---

<div class="post-metadata">

**Author:** ![Iori](https://avatars.discourse-cdn.com/v4/letter/i/90db22/32.png) [@Iori](https://discuss.elastic.co/u/Iori)\
**Post date:** [May 24, 2011, 11:36am UTC](https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464/3 "2011-05-24T11:36:06Z")

</div>

Hi,

"break" might not be right word. It is "break" for us, though.  
It doesn't return the same result as previous version and we need  
QueryParser to behave the same as 3.0.

Anyway, I will create a ticket.

Iori

2011/5/24 Michael McCandless [mail@mikemccandless.com](mailto:mail@mikemccandless.com)

> I think setting this to "true" breaks CJK queries... eg see  
> [http://markmail.org/thread/ww6mhfi3rfpngmc5](http://markmail.org/thread/ww6mhfi3rfpngmc5)
> 
> It was changed to "false" by default in Lucene (see  
> [[LUCENE-2458] queryparser makes all CJK queries phrase queries regardless of analyzer - ASF JIRA](https://issues.apache.org/jira/browse/LUCENE-2458) ) to not break CJK  
> queries.
> 
> But I agree this setting should be controllable via ES.
> 
> Mike
> 
> [http://blog.mikemccandless.com](http://blog.mikemccandless.com)
> 
> On Tue, May 24, 2011 at 12:40 AM, Iori [haseori@gmail.com](mailto:haseori@gmail.com) wrote:
> 
> > Hi,  
> > I wonder if QueryParser.setAutoGeneratePhraseQueries() is exposed through  
> > API.  
> > From Lucene 3.1, the default value of AutoGeneratePhraseQueries becomes  
> > "false" for some reason. It breaks CJK queries. To make CJK queries to  
> > work,  
> > we need to call QueryParser.setAutoGeneratePhraseQueries(true).  
> > If it's not possible, can I open a ticket for it?
> > 
> > Thanks,  
> > Iori

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 24, 2011, 11:57am UTC](https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464/4 "2011-05-24T11:57:14Z")

</div>

Yea, this field is not exposed in ES, open an issue, easy to expose.  
On Tuesday, May 24, 2011 at 2:36 PM, Iori wrote:

> Hi,
> 
> "break" might not be right word. It is "break" for us, though.  
> It doesn't return the same result as previous version and we need QueryParser to behave the same as 3.0.
> 
> Anyway, I will create a ticket.
> 
> Iori
> 
> 2011/5/24 Michael McCandless [mail@mikemccandless.com](mailto:mail@mikemccandless.com)
> 
> > I think setting this to "true" breaks CJK queries... eg see  
> > [http://markmail.org/thread/ww6mhfi3rfpngmc5](http://markmail.org/thread/ww6mhfi3rfpngmc5)
> > 
> > It was changed to "false" by default in Lucene (see  
> > [[LUCENE-2458] queryparser makes all CJK queries phrase queries regardless of analyzer - ASF JIRA](https://issues.apache.org/jira/browse/LUCENE-2458) ) to not break CJK  
> > queries.
> > 
> > But I agree this setting should be controllable via ES.
> > 
> > Mike
> > 
> > [http://blog.mikemccandless.com](http://blog.mikemccandless.com)
> > 
> > On Tue, May 24, 2011 at 12:40 AM, Iori [haseori@gmail.com](mailto:haseori@gmail.com) wrote:
> > 
> > > Hi,  
> > > I wonder if QueryParser.setAutoGeneratePhraseQueries() is exposed through  
> > > API.  
> > > From Lucene 3.1, the default value of AutoGeneratePhraseQueries becomes  
> > > "false" for some reason. It breaks CJK queries. To make CJK queries to work,  
> > > we need to call QueryParser.setAutoGeneratePhraseQueries(true).  
> > > If it's not possible, can I open a ticket for it?
> > > 
> > > Thanks,  
> > > Iori

---

<div class="post-metadata">

**Author:** ![Michael\_McCandless](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@Michael\_McCandless](https://discuss.elastic.co/u/Michael_McCandless)\
**Post date:** [May 24, 2011, 12:33pm UTC](https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464/5 "2011-05-24T12:33:54Z")

</div>

Ahh, OK, makes sense.

You (or ES) could also pass Version.LUCENE\_30 as the "matchVersion"  
param to QueryParser.

Mike

[http://blog.mikemccandless.com](http://blog.mikemccandless.com)

On Tue, May 24, 2011 at 7:36 AM, Iori [haseori@gmail.com](mailto:haseori@gmail.com) wrote:

> Hi,  
> "break" might not be right word. It is "break" for us, though.  
> It doesn't return the same result as previous version and we need  
> QueryParser to behave the same as 3.0.  
> Anyway, I will create a ticket.
> 
> Iori  
> 2011/5/24 Michael McCandless [mail@mikemccandless.com](mailto:mail@mikemccandless.com)
> 
> > I think setting this to "true" breaks CJK queries... eg see  
> > [http://markmail.org/thread/ww6mhfi3rfpngmc5](http://markmail.org/thread/ww6mhfi3rfpngmc5)
> > 
> > It was changed to "false" by default in Lucene (see  
> > [[LUCENE-2458] queryparser makes all CJK queries phrase queries regardless of analyzer - ASF JIRA](https://issues.apache.org/jira/browse/LUCENE-2458) ) to not break CJK  
> > queries.
> > 
> > But I agree this setting should be controllable via ES.
> > 
> > Mike
> > 
> > [http://blog.mikemccandless.com](http://blog.mikemccandless.com)
> > 
> > On Tue, May 24, 2011 at 12:40 AM, Iori [haseori@gmail.com](mailto:haseori@gmail.com) wrote:
> > 
> > > Hi,  
> > > I wonder if QueryParser.setAutoGeneratePhraseQueries() is exposed  
> > > through  
> > > API.  
> > > From Lucene 3.1, the default value of AutoGeneratePhraseQueries becomes  
> > > "false" for some reason. It breaks CJK queries. To make CJK queries to  
> > > work,  
> > > we need to call QueryParser.setAutoGeneratePhraseQueries(true).  
> > > If it's not possible, can I open a ticket for it?
> > > 
> > > Thanks,  
> > > Iori

---

<div class="post-metadata">

**Author:** ![masaru](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@masaru](https://discuss.elastic.co/u/masaru)\
**Post date:** [May 25, 2011, 8:29am UTC](https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464/6 "2011-05-25T08:29:11Z")

</div>

Hi,

Yes, actually I ended up re-setting org.elasticsearch.common.lucene.Lucene.QUERYPARSER\_VERSION using reflection.  
But it looks I don't need it any more since this is already implemented 🙂

Iori  
On Tuesday, May 24, 2011 at 14:33 , Michael McCandless wrote:  
Ahh, OK, makes sense.

> You (or ES) could also pass Version.LUCENE\_30 as the "matchVersion"  
> param to QueryParser.
> 
> Mike
> 
> [http://blog.mikemccandless.com](http://blog.mikemccandless.com)
> 
> On Tue, May 24, 2011 at 7:36 AM, Iori [haseori@gmail.com](mailto:haseori@gmail.com) wrote:
> 
> > Hi,  
> > "break" might not be right word. It is "break" for us, though.  
> > It doesn't return the same result as previous version and we need  
> > QueryParser to behave the same as 3.0.  
> > Anyway, I will create a ticket.
> > 
> > Iori  
> > 2011/5/24 Michael McCandless [mail@mikemccandless.com](mailto:mail@mikemccandless.com)
> > 
> > > I think setting this to "true" breaks CJK queries... eg see  
> > > [http://markmail.org/thread/ww6mhfi3rfpngmc5](http://markmail.org/thread/ww6mhfi3rfpngmc5)
> > > 
> > > It was changed to "false" by default in Lucene (see  
> > > [[LUCENE-2458] queryparser makes all CJK queries phrase queries regardless of analyzer - ASF JIRA](https://issues.apache.org/jira/browse/LUCENE-2458) ) to not break CJK  
> > > queries.
> > > 
> > > But I agree this setting should be controllable via ES.
> > > 
> > > Mike
> > > 
> > > [http://blog.mikemccandless.com](http://blog.mikemccandless.com)
> > > 
> > > On Tue, May 24, 2011 at 12:40 AM, Iori [haseori@gmail.com](mailto:haseori@gmail.com) wrote:
> > > 
> > > > Hi,  
> > > > I wonder if QueryParser.setAutoGeneratePhraseQueries() is exposed  
> > > > through  
> > > > API.  
> > > > From Lucene 3.1, the default value of AutoGeneratePhraseQueries becomes  
> > > > "false" for some reason. It breaks CJK queries. To make CJK queries to  
> > > > work,  
> > > > we need to call QueryParser.setAutoGeneratePhraseQueries(true).  
> > > > If it's not possible, can I open a ticket for it?
> > > > 
> > > > Thanks,  
> > > > Iori

---

<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 6, 2017, 4:05am UTC](https://discuss.elastic.co/t/queryparser-setautogeneratephrasequeries/4464/7 "2017-07-06T04:05:23Z")

</div>


