Multi Phrase Search at the Beginning of a field

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

Multi Phrase Search at the Beginning of a field

ext-vinay.thota
Multi Phrase Search at the Beginning of a field

Hi,

Can some one please help me in providing a solution for my problem:

I have a single field defined in my document. Now I want to do a MultiPhraseQuery - but at the beginning of the field.

For e.g: If there are 3 documents with single field ( say 'title' ) has the values -> "Hello Love you", "Love You Sister", "Love Yoxyz"

Then my search for "Love yo*" ->  MultiPhraseQuery with first term "Love" ( using addTerm("Love") and the next terms ( using addTerms("Yo*"  - after getting all terms 'You' and 'Yoxyz' using IndexReader.terms(Yo) ) should return only the documents "Love You Sister", "Love Yoxyz" - but not "Hello Love you".

Can some one please help me on how to get it done.


Regards,
Vinay

Reply | Threaded
Open this post in threaded view
|

Re: Multi Phrase Search at the Beginning of a field

Andraz Tori-2
You can use standard trick.

Insert a special token at the beginning of every field you are indexing,
and add that special token to beginning of every query.

Since this token will not occur anywhere else in the field, you will
know that your queries match only beginnings of fields

bye
andraz

On Mon, 2008-09-01 at 15:50 +0300, [hidden email] wrote:

> Hi,
>
> Can some one please help me in providing a solution for my problem:
>
> I have a single field defined in my document. Now I want to do a
> MultiPhraseQuery - but at the beginning of the field.
>
> For e.g: If there are 3 documents with single field ( say 'title' )
> has the values -> "Hello Love you", "Love You Sister", "Love Yoxyz"
>
> Then my search for "Love yo*" ->  MultiPhraseQuery with first term
> "Love" ( using addTerm("Love") and the next terms ( using
> addTerms("Yo*"  - after getting all terms 'You' and 'Yoxyz' using
> IndexReader.terms(Yo) ) should return only the documents "Love You
> Sister", "Love Yoxyz" - but not "Hello Love you".
>
> Can some one please help me on how to get it done.
>
>
> Regards,
> Vinay
>
--
Andraz Tori, CTO
Zemanta Ltd, London, Ljubljana
www.zemanta.com
mail: [hidden email]
tel: +386 41 515 767
´╗┐twitter: andraz, skype: minmax_test



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

Reply | Threaded
Open this post in threaded view
|

RE: Multi Phrase Search at the Beginning of a field

ext-vinay.thota
 Excellent, it worked :)

Thank you Tori!!

Regards,
Vinay

>-----Original Message-----
>From: ext Andraz Tori [mailto:[hidden email]]
>Sent: 01 September, 2008 16:39
>To: [hidden email]
>Subject: Re: Multi Phrase Search at the Beginning of a field
>
>You can use standard trick.
>
>Insert a special token at the beginning of every field you are
>indexing, and add that special token to beginning of every query.
>
>Since this token will not occur anywhere else in the field,
>you will know that your queries match only beginnings of fields
>
>bye
>andraz
>
>On Mon, 2008-09-01 at 15:50 +0300, [hidden email] wrote:
>> Hi,
>>
>> Can some one please help me in providing a solution for my problem:
>>
>> I have a single field defined in my document. Now I want to do a
>> MultiPhraseQuery - but at the beginning of the field.
>>
>> For e.g: If there are 3 documents with single field ( say 'title' )
>> has the values -> "Hello Love you", "Love You Sister", "Love Yoxyz"
>>
>> Then my search for "Love yo*" ->  MultiPhraseQuery with first term
>> "Love" ( using addTerm("Love") and the next terms ( using
>> addTerms("Yo*"  - after getting all terms 'You' and 'Yoxyz' using
>> IndexReader.terms(Yo) ) should return only the documents "Love You
>> Sister", "Love Yoxyz" - but not "Hello Love you".
>>
>> Can some one please help me on how to get it done.
>>
>>
>> Regards,
>> Vinay
>>
>--
>Andraz Tori, CTO
>Zemanta Ltd, London, Ljubljana
>www.zemanta.com
>mail: [hidden email]
>tel: +386 41 515 767
>´╗┐twitter: andraz, skype: minmax_test
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>