Best solution for clickable search list in Rails - ruby-on-rails

I'm developing an app in Rails with a nutrient database. Now I'm looking for an easy solution for users to search the database through a search field, which as they type will present a list of records from the database, which at the same time are clickable and once clicked will direct them directly to the show path of that nutrient.
I'm thinking of something like this. If you enter e. g. "burger" it does exactly what I need.
I've been researching now for some days and found solutions from jQuery autocomplete to Elasticsearch to typeahead.js but now I'm totally lost, which solution would be the right one for my usecase (I tried jQuery autocomplete but at the end it turned out that this is not exactly what I need).
Anybody some ideas?
Thanks.

Algolia is a well known solution for instant search, but not the easiest one to implement (though their support team is incredible).
You should look into searchkick which is based on elasticsearch, and has an instant search feature.
It is relatively easy to implement, and pretty well documented.

Related

How to get specific results using MediaWiki API in Rails backend?

I'm doing my final project for a coding school that will be a deep song search app that returns every detail about a song (composer, personnel on the track, lyrics, studio, media uses, images, etc). I'm using React frontend/Rails backend API. I'm new to API's and have tried Discogs and Musicbrainz but find the Mediawiki to be the easiest to traverse. Messing with their sandbox using Query, I feel like I'm getting closer but wondering if anyone with more experience out there could help me get precisely what I need.
I would like a music search to return a list of matches (could be same title but different songs or same title but different recordings). A user can click on the results to see the details. I would like the API to return links and hopefully images (album cover, etc). Does anyone know the best way to go about this?
I've also tried using the Ruby Gem wrapper Mediawikitory https://github.com/molybdenum-99/mediawiktory. I like the clean interface but can't quite find the right parameters.
The closest I've come to what I'm looking for in the Mediawiki sandbox is an example like this for the All Star (Smash Mouth):
https://en.wikipedia.org//w/api.php?action=query&format=json&prop=&list=search&continue=-%7C%7C&srsearch=star%20(song)&srlimit=5&sroffset=15&srqiprofile=engine_autoselect&srwhat=text&srinfo=totalhits%7Csuggestion%7Crewrittenquery&srinterwiki=1
This gives a list of songs (I'll have to concatenate '(song)' in every search unless there's a specific category parameter I don't know about).
So with further research I was able to drill down to specific song searches (and this will work for any thing this specific). You have to use srsearch and then search option in lists. So an example for a list of songs based on a given title:
https://en.wikipedia.org/w/api.php?action=query&formatversion=2&format=json&prop=info%7Cpageimages&generator=search&inprop=url&piprop=thumbnail%7Cname&gsrsearch=I%20love%20you%20(song)&gsrwhat=text
Make sure you choose version 2 as it gives you a better formatted Object to map over.
The Mediawiki API is very robust. You just have to spend a little time with it. The sandbox is great.

Using grails filterpane plugin with one "search" input field

is it possible to use the grails filterpane-plugin in a way that uses just one search box? i know it seems a little odd, because obviously the whole thing about this plugin that the user can specify what attributes should be filtered in what kind and with whatever filter terms.
What i would like to achieve is, that the user can search for any attribute that is displayed in the grid like it is possible in this jira example. i know i could come up with something like the searchable plugin to get that done, but im not sure how i could combine this with the standard filter activities that are provided by the filterpane plugin, so i'm looking for a solution that is based on filterpane. If you have any advice or opinion about the searchable-plugin solution, please let me know.
Thanks
I use the quick search plugin for this in my app.

Advice with Full Text Search Engine in Rails

I am trying to add to my website a search bar like the one on Facebook. I want my users to be able to search through my products, my other users ... But I also want the result to be displayed in real time without pressing a button. I am currently looking at several options (thinking-sphinx, ferret, ...) but I am not sure which one to use and that's why I would like to get advices from pros ;)
So my requirement are :
Result to be displayed in real-time in a box on the current page.
Css Customizable
Be able to search through severals table in my PostGreSQL DB.
I am currently using Heroku for production.
I want to choose the best one for my needs and that's why I am asking your opinion.
Thanks in advance !
Make sure to separate how you want data displayed (your first two requirements) from how you want it indexed (third) from how you want to deploy.
Let's start backwards. Heroku provides limited support for machine configuration; both options you mention require installation of a service that reads and writes files. Heroku has such an option in two ways: 1) PostgreSQL has a built-in full-text search capability, and 2) Heroku has made Flying Sphinx an option, as well as these other options documented on the Heroku site. The first two options may provide the easiest linkage to your database, but I haven't tried other options, so it's possible they do too. So now you have a search index, deployed.
Real-time "incremental" search is purely a matter of presentation ... and maybe performance. Start typing and you start getting results is nothing more than sending requests via AJAX to the search server, typically after a short delay in typing (maybe 50ms), and handling the display of results. There are a couple of ways to make that simple written up here in this SO answer.
I ended up keeping the PostgreSQL engine for now but used select2 as the jquery for the presentation and was able to get a facebook like search box :
Select2 with Rails and JSON
Thanks for you help !

Can anyone recommend a gem for searching that actually allows me to easily filter my results in ruby on rails?

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
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
You can go for Elasticsearch. Ruby has the 'Tire' gem, which is a client for ElasticSearch http://www.elasticsearch.org/

Search Engine Help

I have a mediawiki installation that I've customized with some of my own extensions. Here is the basic platform, pretty standard LAMP install.
Ubuntu Server
Apache 2
Mediawiki 1.15
PHP 5.2.6
MySQL 5.0.67
For the actual MW search I use Lucene (EzMwLucene). I also have custom extension that displays tabular data from a separate database within a MW page. Lucene doesn't index this info (which, in my case is actually good because it would clutter your expected search results). For this installation I didn't do anything to Lucene other than install it and wouldn't know how to customize it for my needs and it may be "too powerful".
At any rate, I need to create a search for the data in my other database. I have a master table that is updated daily based on data stored in other (normalized) tables. At the moment it is one of these searches that basically creates a SQL query based on the criteria you enter. This is a lot of work, though. I would like it to be more of a "type and submit" type search.
I don't think I need a comprehensive "cut & paste" type answer, but if anybody has something that I can google I would be very appreciative. I don't need to recreate the wheel, which is what I would be doing if I followed what I see in google.
If you would like to see my master database, let me know, I would want to sanitize it to make me more anonymous (whatever that means). Also, if you're familiar with MW and would like to see any of my extension code, again, let me know.
TL;DR: need to make a custom search feature with LAMP (displayed in Mediawiki). Any guidance appreciated.
Thanks SO!
Why do you need to add custom search? This will relate to the best answer.
For simplicity, you could use the Google Search Engine - http://www.mediawiki.org/wiki/Extension:Google_Custom_Search_Engine
Otherwise it sounds like you need to write a full-text query for the database.

Resources