Search code examples
ruby-on-railssearchlogic

Searchlogic - searching for exact match


I am using Searchlogic to perform searches on my 'report' index page.

<% form_for @search do |f| %>
  Search:
  <%= f.text_field :report_id_like, :size=> 50 %>
  <%= f.submit "Search" %>
<% end %>

Currently, if I search for a report with report id '5', I get a list of entries with report id containing '5'.

I would like to get only the record with report_id '5' when I input '5'.

Any suggestion?

Many thanks


Solution

  • Got the answer:

    Instead of :

    <%= f.text_field :report_id_like, :size=> 50 %>
    

    Put:

    <%= f.text_field :report_id_equals, :size=> 50 %>
    

    Hope it might be of help to someone else