Sunspot / Solr Full-text search - how to exclude certain fields from full-text search?

I did a solr search for my rails application. I indexed the search fields and it works fine. Now I want to exclude one specific field named Title during the search. How can I skip this field during the search. Are there exceptions for indexed text fields.

searchable  do

  integer :id
  boolean :searchable
  boolean :premium
  string  :status
  time    :updated_at
  time    :created_at

  ###################################################
  # Fulltext search fields

  text :title

  text :summary 
  text :skills

end

Here, how can I exclude only the Title field from a full-text search .like

 profiles = Profile.search do |s|
   s.fulltext @selected_filters[:query][:value] , exclude => :title
end

Is there any way to do this? please, help

+5
source share
1 answer

You can specify which fields to include in your search.

Profile.search do
  keywords @selected_filters[:query][:value], :fields => [:summary, :skills], :minimum_match => 1
end
+4
source

All Articles