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 Cam Bazz <ca...@gmail.com> on 2008/09/16 07:33:48 UTC

Phrase Query

Hello,

Lets say I have two documents, both containing field F.

document 0 has the string "a b" as F
document 1 has the string "b a" as F

I am trying to make a phrasequery like:

        PhraseQuery pq = new PhraseQuery();
        pq.add(new Term("F", "a"));
        pq.add(new Term("F", "b"));
        pq.setSlop(2);

and then search. however I was not successful finding anything.

any ideas?

Best Regards,
-C.B.

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


Re: Phrase Query

Posted by Antony Bowesman <ad...@teamware.com>.
> Is it possible to write a document with different analyzers in different fields?

PerFieldAnalyzerWrapper




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


Re: Phrase Query

Posted by Cam Bazz <ca...@gmail.com>.
I noticed this was because I was using a KeywordAnalyzer.

Is it possible to write a document with different analyzers in different fields?

Best.

On Tue, Sep 16, 2008 at 8:33 AM, Cam Bazz <ca...@gmail.com> wrote:
> Hello,
>
> Lets say I have two documents, both containing field F.
>
> document 0 has the string "a b" as F
> document 1 has the string "b a" as F
>
> I am trying to make a phrasequery like:
>
>        PhraseQuery pq = new PhraseQuery();
>        pq.add(new Term("F", "a"));
>        pq.add(new Term("F", "b"));
>        pq.setSlop(2);
>
> and then search. however I was not successful finding anything.
>
> any ideas?
>
> Best Regards,
> -C.B.
>

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