Can thinking-sphinx ransack work together?
Asked Answered
R

1

6

Our project is using Ransack at the moment, we are thinking to introduce Thinking-Sphinx. However they both use search keyword. Is any way to use Thinking-Sphinx and Ransack in a same project?

Thank in advance.

Ruffianism answered 12/4, 2012 at 2:46 Comment(0)
S
8

Ransack's search method is just an alias. You can use the ransack method instead.

Instead of:

@q = Person.search(params[:q])
@people = @q.result(:distinct => true)

Use:

@q = Person.ransack(params[:q])
@people = @q.result(:distinct => true)

Person.search should call ThinkingSphinx as usual.

Spokeshave answered 2/5, 2012 at 21:7 Comment(1)
But what if I`m using it in a single form - so that i would like to have search quiery be separated form ransack params? Should i employ custom params processing or digg into ransack code?Penicillate

© 2022 - 2024 — McMap. All rights reserved.