lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From baris.ka...@oracle.com
Subject Re: ComplexPhraseQueryParser isn't switching search terms to lowercase with StandardAnalyzer
Date Mon, 21 Oct 2019 19:21:37 GMT
David,-

  which version of Lucene are You using?

Best regards


On 10/21/19 1:31 PM, Shifflett, David [USA] wrote:
> Hi all,
> Using the code snippet:
>      ComplexPhraseQueryParser qp = new ComplexPhraseQueryParser(“somefield”, new
StandardAnalyzer());
>      String teststr = "\"Foo Bar\"~2";
>      Query queryToSearch = qp.parse(teststr);
>      System.out.println("Query : " + queryToSearch.toString());
>      System.out.println("Type of query : " + queryToSearch.getClass().getSimpleName());
>
> I am getting the output
>      Query : "Foo Bar"~2
>      Type of query : ComplexPhraseQuery
>
> If I change teststr to "\"Foo Bar\""
> I get
>      Query : "Foo Bar"
>      Type of query : ComplexPhraseQuery
>
> If I change teststr to "Foo Bar"
> I get
>      Query : content:foo content:bar
>      Type of query : BooleanQuery
>
>
> In the first two cases I was expecting the search terms to be switched to lowercase.
>
> Were the Foo and Bar left as originally specified because the terms are inside double
quotes?
>
> How can I specify a search term that I want treated as a Phrase,
> but also have the query parser apply the LowerCaseFilter?
>
> I am hoping to avoid the need to handle this using PhraseQuery,
> and continue to use the QueryParser.
>
>
> Thanks in advance for any help you can give me,
> David Shifflett
>

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


Mime
View raw message