> 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?