Thankyou Ahmet. You were right. artist_s:Dora is bringing results.
But I need artist_s:Dora the explorer to bring only those results which contain 
"Dora the explorer".
 
I tried to give artist_s:"Dora the explorer" (phrase search).. that is working. 
But artist_s:Dora the explorer is not working. Any way to make this 
artist_s:Dora the explorer to return results that contain this in them.
 
Thanks.

________________________________

From: Ahmet Arslan [mailto:iori...@yahoo.com]
Sent: Tue 3/23/2010 9:32 AM
To: solr-user@lucene.apache.org
Subject: Re: Perfect Match




> I need help on one of my issues with perfect matching of
> terms.
> 
> I have a collection of artists which are stored in the
> index against the field name artist_t which is a text type
> field. This field consists of values like ["dora", Dora The
> Explorer", "Princess Dora The explorer"] across various docs
> as in
> 
> <doc>
> <field name="artist_t">Dora</field>
> </doc>
> <doc>
> <field name="artist_t">Dora The
> Explorer</field>
> </doc>
> <doc>
> <field name="artist_t">Princess Dora The
> Explorer</field>
> </doc>
> 
> I am searching specifically on artist_t like
> q=artist_t:Dora.
> What I need is the one document which matches exactly with
> Dora, ie. the first doc. "Dora the Explorer" and "Princess
> Dora The Explorer" should not come along with it.
> 
> But I am getting all the above.
> 
> To tackle this problem, I tried to copyfield this artist_t
> to a new field called artist_s which is of type string and
> indexed the content again. But this approach also doesnt
> help.

with type="string" &q=artist_s:Dora should return only
<doc>
<field name="artist_s">Dora</field>
</doc>

> I tried to create a new field type with Keyword Tokenizer.
> and tried to create a field of that type and copied artist_t
> to this field. That also doesnt work.

May be you have trailing white-spaces in your artists? Can you try with adding 
TrimFilterFactory after KeywordTokenizerFactory?

> Is there any way of doing this??
> 
> I need exact match ie. if I search for artist_t:Dora The
> Explorer, I should get only the second doc and not the third
> one(Princess Dora The Explorer).

Note that q=artist_t:Dora The Explorer is parsed into artist_t:Dora 
defaultField:The defaultField:Explorer

Can you do your tests with &q=artist_s:Dora?


     


Reply via email to