Phrase Query

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Phrase Query

Cam Bazz
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Phrase Query

Cam Bazz
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 <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

adb
Reply | Threaded
Open this post in threaded view
|

Re: Phrase Query

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

PerFieldAnalyzerWrapper




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Phrase Query

Otis Gospodnetic-2
In reply to this post by Cam Bazz
Are the terms stopwords?

 
Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----

> From: Cam Bazz <[hidden email]>
> To: [hidden email]
> Sent: Tuesday, September 16, 2008 1:33:48 AM
> Subject: 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: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Phrase Query

Cam Bazz
Hello Otis,

Well this was just an example. But upon further thinking on the
problem, i figured out i need my own tokenizer.

I need to give this tokenizer two words, where each one is made to a
token, and then put inside a field.

imagine word src="car seat" and dst="leather" - so I want a tokenizer
take those two, and make two tokens as keyword analyzer would do.

This way one can search bidirectionally edges of a graph with one
phrase query of slop 2.

Is it possible to do such a manupulation?

Best.

On Tue, Sep 16, 2008 at 7:15 PM, Otis Gospodnetic
<[hidden email]> wrote:

> Are the terms stopwords?
>
>
> Otis
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
>
>
> ----- Original Message ----
>> From: Cam Bazz <[hidden email]>
>> To: [hidden email]
>> Sent: Tuesday, September 16, 2008 1:33:48 AM
>> Subject: 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]