Sure, here's the code:
search_params = get_location_filter.present? ? { conditions: { near:
get_location_filter } } : {}
search_params[:with] = { category_ids: get_category_filter } if
get_category_filter.present?
@events = Event.search(search_params).sx_limit(7)
render
Also, here's declaration of sx_limit scope:
sphinx_scope(:sx_limit) { |limit| { limit: limit } }
get_location_filter helper just returns unescaped query from user input.
Also, here's declaration of :near field:
indexes [location.country, location.city, location.country_full_name], as:
:near
среда, 26 декабря 2012 г., 16:13:18 UTC+3 пользователь Pat Allan написал:
>
> Hi Alexander
>
> Can you share the controller action that's making this search call? I'd
> like to get the full context, which may provide some clues as to why you're
> getting this error.
>
> Cheers
>
> --
> Pat
>
> On 27/12/2012, at 12:08 AM, Alexander Sologub wrote:
>
> > Forgot to mention - Sphinx returns errors (and Thinking Sphinx firing
> exceptions) when search term consists of separators ONLY.
> > Example:
> > @some_field ![]''
> >
> >
> > вторник, 25 декабря 2012 г., 16:56:07 UTC+3 пользователь Alexander
> Sologub написал:
> > Hi there!
> > We are using Thinking Sphinx for fulltext search in our project, but now
> we face that nifty problem.
> > As I red in Sphinx documentation, characters missing in charset_table
> should be treated like separators.
> > Also, I call Riddle.escape('my_gorgeous_request') before calling
> ::search method on my models.
> > But I don't get expected result (at least empty one). I end up with
> ThinkingSphinx::SphinxError.
> >
> > So, the question is - How can I solve this?
> > Should I add all undesired symbols to charset_table? But it's kind of
> stupid to copy all UTF-8 table there...
> > Maybe there's some kind of configuration option I don't know about (for
> Sphinx itself?)
> > Or maybe, I'm doing something wrong?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Thinking Sphinx" group.
> > To view this discussion on the web visit
> https://groups.google.com/d/msg/thinking-sphinx/-/HdceEdphtfIJ.
> > To post to this group, send email to
> > [email protected]<javascript:>
> .
> > To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> > For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/thinking-sphinx/-/Umh7IOqKangJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.