AnsweredAssumed Answered

Solr search results depend on Accept-Language http header

Question asked by mando.alvarado.jose on Apr 23, 2013
Latest reply on May 9, 2013 by andy
I have a webscript which searches for nodes that have a certain string stored in a certain property. This is a name property, and by name, i mean people names. The end users of this application will be mostly Spanish speaking, and the names stored in these properties will also mostly be Spanish names.

Now the interesting part. I run the webscript (which returns an ajax response) and tell it to search for nodes that have "Mario" in that property. On my machine, everything works fine, and only "Mario"s show up. On my co-worker's machine however, he gets "Maria"s as well as "Mario"s.

I checked his request headers and compared them to mine. Every header was practically the same, except for the Accept-Language header. Mine was sent with the value of "en-US,en;q=0.8". I don't remember his exactly, but it started with "es-HN".

Well, this was no surprise. My OS and browser are in english, and his are in spanish. So I modified that request header and used his value, and sure enough, I got the same response from the webscript as he did.

I would like to know how to "fix" this. I realize this is probably a feature, but I would like to know how to disable it. If I search for "Mario" i would like to find nodes who contain this word, exactly as it is, regardless of the user's browser's language settings. It may be surrounded by other characters and what not, but the whole word, no less, MUST be there.

I searched online for answers but have come up with very little. The word "stemming" came up a few times. I also came across people who mentioned a StandardAnalyzer and a SpanishSnowballAnalyzer. I have only a vague idea of what these are but no clue how to use them.

Any help will be greatly appreciated.