Can anyone recommend a gem for searching that actu

2019-08-27 22:06发布

问题:

I've tried thinking sphinx after being pointed in that direction and simple filtering seems impossible. I've googled and asked questions for 2 days now and it seems it can't be done which is shocking because it's something commonly done when searching on websites.

All I would like to do add filtering options to my search form such as filtering by one or a combination of:

When user hits browse page all the sites users are returned but showing 20 results per page

Filtering options

in: location

who are: sexual preference

between the ages: age range

and located in: country

My search page works fine because all I require is 1 textfield a user uses for finding users by email, username or full name. My browse page is a different story because I'm using 1 form with multiple text fields and one or two select fields.

Example

Is there a gem that does this easily and performs well at the same time?

or would doing this manually via find methods be the only way?

Kind regards

回答1:

Apart from using Sphinx and Thinking Sphinx, you can think of those gems: meta_where and meta_search

However after reading your description I think Sphinx is the best choice here indeed.

You wrote that it seems impossible to apply simple filtering using Thinking Sphinx. Let me explain a bit of Thinking Sphinx within the post you mentioned under the link: Example



回答2:

You can go for Elasticsearch. Ruby has the 'Tire' gem, which is a client for ElasticSearch http://www.elasticsearch.org/