ruby - Sunspot in rails 4.How to search character? -


my project online mobile shopping site.

i'm trying search in full-text-search solr. when search "lumia",it show phones have name lumia. search "lu",it doesnt show anything.

what should when search "l" or "lu" or "mia",it still show phones lumia ?

i search field :name of model phone.

my code:

class phone < activerecord::base searchable    text :name end  class searchcontroller < applicationcontroller   def create    @a = phone.search       fulltext    end    @result = @a.results    render :index end  private    def        params[:keyword]    end 

the form search:

<%= form_tag search_index_path  %>     <%= text_field_tag :keyword,params[:keyword] %>     <%= submit_tag :search %> <%end%> 


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -