How do I escape illegal characters in a sunspot/solr fulltext search?

262 views
Skip to first unread message

ericindc

unread,
Aug 15, 2011, 3:44:31 PM8/15/11
to Sunspot
I have a sunspot/solr setup for fulltext searching model attributes.
My QA just searched on " and +, both of which caused a 500 error:

Solr Response:
orgapachelucenequeryParserParseException_Cannot_parse__Encountered_EOF_at_line_1_column_0_Was_expecting_one_of_____NOT______________________________QUOTED______TERM______PREFIXTERM______WILDTERM__________________NUMBER______TERM____________

How can I make these query strings safe? Is there a method in Sunspot
to handle this?

James Hart

unread,
Aug 15, 2011, 10:05:41 PM8/15/11
to ruby-s...@googlegroups.com
Try to figure out how to use the edismax parser, instead of the dismax parser.

ericindc

unread,
Aug 16, 2011, 6:44:36 PM8/16/11
to Sunspot
Thanks, James. I'm digging around the Heroku docs to see if this is
doable and if so how. Let me know if you have input. Cheers.

On Aug 15, 10:05 pm, James Hart <hjh...@gmail.com> wrote:
> Try to figure out how to use the edismax parser, instead of the dismax
> parser.
>
> Check this thread out for more
> information:https://groups.google.com/forum/#!searchin/ruby-sunspot/edismax/ruby-...

Nick Zadrozny

unread,
Aug 16, 2011, 7:15:41 PM8/16/11
to ruby-s...@googlegroups.com
On Tue, Aug 16, 2011 at 3:44 PM, ericindc <ericm...@gmail.com> wrote:
Thanks, James.  I'm digging around the Heroku docs to see if this is
doable and if so how.  Let me know if you have input.  Cheers.

If you're on Heroku, then you're probably talking about Websolr. In which case you should talk to me by dropping me a line at in...@onemorecloud.com or http://help.websolr.com :)

In short, we've got Solr 3.3 servers, where you can use edismax, but they're not the default on Heroku. That said, I'm happy to help you get up and running with edismax on Websolr if you're interested in using it.

--
Nick Zadrozny

http://websolr.com — hassle-free hosted search, powered by Apache Solr

Andy Lindeman

unread,
Aug 18, 2011, 12:54:54 PM8/18/11
to ruby-s...@googlegroups.com
On Tue, Aug 16, 2011 at 19:15, Nick Zadrozny <ni...@onemorecloud.com> wrote:
> If you're on Heroku, then you're probably talking about Websolr. In which
> case you should talk to me by dropping me a line at in...@onemorecloud.com or
> http://help.websolr.com :)
> In short, we've got Solr 3.3 servers, where you can use edismax, but they're
> not the default on Heroku. That said, I'm happy to help you get up and
> running with edismax on Websolr if you're interested in using it.

On that note, is there any documentation for edismax syntax? I can't
find anything other than the JIRA issue:
<https://issues.apache.org/jira/browse/SOLR-1553> .. which is hard to
read (IMHO).

--
Andy Lindeman
http://www.andylindeman.com/

Reply all
Reply to author
Forward
0 new messages