This rails app contains examples on how to implement autosuggest functionality using SOLR and PostgreSQL’s native search function.
Peruse the following files in order to gain insight on autosuggest with SOLR:
-
config/initializers/sunspot.rb
-
solr/conf/schema.xml (lines 62-72, 109-120, and line 272)
-
app/models/product.rb (lines 8-11)
-
app/models/sample.rb (on how to use it)
-
Gemfile (line 27-28)
-
migration files
-
lib/tasks/enhance_schema_load.rake
-
lib/*.rb
-
app/models/product.rb
-
app/models/sample.rb
-
Gemfile (line 30)
The code here only handles autosuggest on has_one associations. Maybe in the future I could add a sample on how to create tsvector column on has_many associations.
-
Inspired by bradleypriest.com/2013/08/27/pgsearch_talk/