lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shalin Shekhar Mangar <shalinman...@gmail.com>
Subject Re: Exact word search
Date Wed, 26 Aug 2009 07:19:56 GMT
On Tue, Aug 25, 2009 at 10:40 AM, bhaskar chandrasekar <bas_sree@yahoo.co.in
> wrote:

> Hi,
>
> Can any one helpe me with the below scenario?.
>
> Scenario 1:
>
> Assume that I give Google as input string
> i am using Carrot with Solr
> Carrot is for front end display purpose


It seems like Carrot is the one making the queries to Solr? In that case,
this question may be better suited for carrot users/developers.


>
> the issue is
> Assuming i give "BHASKAR" as input string
> It should give me search results pertaining to BHASKAR only.
>  Select * from MASTER where name ="Bhaskar";
>  Example:It should not display search results as "ChandarBhaskar" or
>  "BhaskarC".
>  Should display Bhaskar only.
>


That is easy with Solr, make a query like field-name:"Bhaskar". Make sure
that field name is not tokenized i.e. string type in schema.xml


>
> Scenario 2:
>  Select * from MASTER where name like "%BHASKAR%";
>  It should display records containing the word BHASKAR
>  Ex: Bhaskar
> ChandarBhaskar
>  BhaskarC
>  Bhaskarabc
>

Leading wildcards are not supported. However there are alternate ways of
doing it.

Create two fields, keep one as a normal string type and use a
KeywordTokenizer and ReverseFilter on the other. Make one field a copyField
of the other. Perform a prefix search on both fields.

-- 
Regards,
Shalin Shekhar Mangar.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message