You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by jawedshamshedi <ja...@gmail.com> on 2012/01/20 12:57:27 UTC
Search within words
Hi all,
I want to search a string in the same way as mysql like does i.e.
if the word is say Sunrise then if i search rise then again sun rise should
come and if I choose sun then again sunrise should come and if I use sunrise
then again sunrise should come in search.
the search should no be case sensitive.
Will need a descriptive answer to do this as I am new to solr
Thanks
--
View this message in context: http://lucene.472066.n3.nabble.com/Search-within-words-tp3675210p3675210.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Search within words
Posted by Erick Erickson <er...@gmail.com>.
Please provide more info. In particular what is the
output when you attach &debugQuery=on?
Best
Erick
On Mon, Jan 23, 2012 at 5:11 AM, Lee Carroll
<le...@googlemail.com> wrote:
> check your defaultOperator, ensure its OR
>
> On 23 January 2012 05:56, jawedshamshedi <ja...@gmail.com> wrote:
>> Hi
>> Thanks for the reply..
>> I am using NGramFilterFactory for this. But it's not working as desired.
>> Like I have a field article_type that has been indexed using the below
>> mentioned field type.
>>
>> <fieldType name="liketext" class="solr.TextField"
>> positionIncrementGap="100">
>> <analyzer type="index">
>> <tokenizer class="solr.KeywordTokenizerFactory"/>
>> <filter class="solr.LowerCaseFilterFactory"/>
>> <filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="25"
>> />
>> </analyzer>
>> <analyzer type="query">
>> <tokenizer class="solr.KeywordTokenizerFactory"/>
>> <filter class="solr.LowerCaseFilterFactory"/>
>> </analyzer>
>> </fieldType>
>>
>> The field definition for indexing is :
>> <field name="article_type" type="liketext" indexed="true" stored="true"
>> />
>>
>> now the problem is that I have a value article_type field has values like
>> earrring and ring and it's required that when we search for ring earring
>> should also come. But it's not happening.
>>
>> What else needs to be done in order to achieve this.
>>
>> Any further help will be appreciated.
>>
>> Thanks
>>
>>
>>
>> --
>> View this message in context: http://lucene.472066.n3.nabble.com/Search-within-words-tp3675210p3681044.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
Re: Search within words
Posted by Lee Carroll <le...@googlemail.com>.
check your defaultOperator, ensure its OR
On 23 January 2012 05:56, jawedshamshedi <ja...@gmail.com> wrote:
> Hi
> Thanks for the reply..
> I am using NGramFilterFactory for this. But it's not working as desired.
> Like I have a field article_type that has been indexed using the below
> mentioned field type.
>
> <fieldType name="liketext" class="solr.TextField"
> positionIncrementGap="100">
> <analyzer type="index">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="25"
> />
> </analyzer>
> <analyzer type="query">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> </analyzer>
> </fieldType>
>
> The field definition for indexing is :
> <field name="article_type" type="liketext" indexed="true" stored="true"
> />
>
> now the problem is that I have a value article_type field has values like
> earrring and ring and it's required that when we search for ring earring
> should also come. But it's not happening.
>
> What else needs to be done in order to achieve this.
>
> Any further help will be appreciated.
>
> Thanks
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Search-within-words-tp3675210p3681044.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: Search within words
Posted by jawedshamshedi <ja...@gmail.com>.
Hi
Thanks for the reply..
I am using NGramFilterFactory for this. But it's not working as desired.
Like I have a field article_type that has been indexed using the below
mentioned field type.
<fieldType name="liketext" class="solr.TextField"
positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="25"
/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
The field definition for indexing is :
<field name="article_type" type="liketext" indexed="true" stored="true"
/>
now the problem is that I have a value article_type field has values like
earrring and ring and it's required that when we search for ring earring
should also come. But it's not happening.
What else needs to be done in order to achieve this.
Any further help will be appreciated.
Thanks
--
View this message in context: http://lucene.472066.n3.nabble.com/Search-within-words-tp3675210p3681044.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Search within words
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hello,
You can accomplish this by using n-grams or edge n-grams, which you'll use as field types for fields where you want such matching to occur and that you will specify in schema.xml. I hope this helps.
Otis
----
Performance Monitoring SaaS for Solr - http://sematext.com/spm/solr-performance-monitoring/index.html
----- Original Message -----
> From: jawedshamshedi <ja...@gmail.com>
> To: solr-user@lucene.apache.org
> Cc:
> Sent: Friday, January 20, 2012 6:57 AM
> Subject: Search within words
>
> Hi all,
>
> I want to search a string in the same way as mysql like does i.e.
> if the word is say Sunrise then if i search rise then again sun rise should
> come and if I choose sun then again sunrise should come and if I use sunrise
> then again sunrise should come in search.
>
> the search should no be case sensitive.
>
> Will need a descriptive answer to do this as I am new to solr
>
> Thanks
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Search-within-words-tp3675210p3675210.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>