You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Shifflett, David [USA]" <Sh...@bah.com> on 2019/10/21 21:22:55 UTC

Re: [External] Re: ComplexPhraseQueryParser isn't switching search terms to lowercase with StandardAnalyzer

Baris,

Sorry I neglected to add that piece.
This test was run against 8.0.0,
but I also want it to work in later versions.

Another piece of my project is using 8.2.0.

Thanks again for any info,
David Shifflett


On 10/21/19, 3:23 PM, "baris.kazar@oracle.com" <ba...@oracle.com> wrote:

    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
    
    


Re: [External] Re: ComplexPhraseQueryParser isn't switching search terms to lowercase with StandardAnalyzer

Posted by ba...@oracle.com.
I wonder if this repeats in version 7.7.2, too?

Best regards


On 10/21/19 5:22 PM, Shifflett, David [USA] wrote:
> Baris,
>
> Sorry I neglected to add that piece.
> This test was run against 8.0.0,
> but I also want it to work in later versions.
>
> Another piece of my project is using 8.2.0.
>
> Thanks again for any info,
> David Shifflett
>
>
> On 10/21/19, 3:23 PM, "baris.kazar@oracle.com" <ba...@oracle.com> wrote:
>
>      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
>      
>      
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

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