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 Nicholas Fellows <ni...@djdownload.com> on 2012/01/19 15:18:27 UTC

ampersands in index or query

I have some data in solr

where the text string could potentially be

"Vic & Bobs greatest hits"

how can i ensure that when a user query is made
for "Vic and Bobs greatest hits" , a match is made?

this also needs to work the other way round.

i've not found any useful information about this scenario

Cheers

N...

-- 
Nick Fellows
DJdownload.com

Re: ampersands in index or query

Posted by Erick Erickson <er...@gmail.com>.
Another approach is to use the stopwords and an appropriate
analyzer chain. Then both the & and "and" would be removed
from the indexing stream and the query process and it would
"just work"..

Best
Erick

On Thu, Jan 19, 2012 at 8:09 AM, Gora Mohanty <go...@mimirtech.com> wrote:
> On Thu, Jan 19, 2012 at 7:48 PM, Nicholas Fellows <ni...@djdownload.com> wrote:
>> I have some data in solr
>>
>> where the text string could potentially be
>>
>> "Vic & Bobs greatest hits"
>>
>> how can i ensure that when a user query is made
>> for "Vic and Bobs greatest hits" , a match is made?
>>
>> this also needs to work the other way round.
>>
>> i've not found any useful information about this scenario
>
> Haven't tried this particular case, and it is possible that
> there might be a need to escape & as &amp; but in
> general, Solr synonyms should address this kind of a
> need. Please see:
> http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
> and the setup in the default schema.xml.
>
> Regards,
> Gora

Re: ampersands in index or query

Posted by Gora Mohanty <go...@mimirtech.com>.
On Thu, Jan 19, 2012 at 7:48 PM, Nicholas Fellows <ni...@djdownload.com> wrote:
> I have some data in solr
>
> where the text string could potentially be
>
> "Vic & Bobs greatest hits"
>
> how can i ensure that when a user query is made
> for "Vic and Bobs greatest hits" , a match is made?
>
> this also needs to work the other way round.
>
> i've not found any useful information about this scenario

Haven't tried this particular case, and it is possible that
there might be a need to escape & as &amp; but in
general, Solr synonyms should address this kind of a
need. Please see:
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
and the setup in the default schema.xml.

Regards,
Gora