MySQL Full-text search in Ruby on Rails -
I am trying to implement basic full text search with MySQL.
I have written this migration:
def self.up execute 'ALTER TABLE PHOTOS ENGINE = MyISAM' execute 'photo to create integer fulltext_photos (location, info)' End df self.down execute 'optional table photos engine = execute InnoDB' drop index flicktest_photos end photo
and my model is here:
Def self.search (* args) options = args.extract_options! Find_by_sql ["SELECT * photos from WHERE MATCH (against place, information)" (?) ", Option [: query]] termination
The problem is that this code is always Empty array .
For example:
% Photo.find (: first) => Photo ID: 1, place: "backenone", info: "Euro VISCARAN ERBA ALTA." ..% Photo.search (: all ,: query => 'bacano') => []
I have created a project (Rails 2.3.2, Ruby 1.9.1 MySQL 5.0) to simulate this. With a record in the database, I have achieved the same results that you have made. When I add more records, the photo. The search order got the record.
This can be because "the words in 50% or more rows are considered normal and do not match".
The 50% threshold does not apply in binary mode.
Comes in the bracket in binary mode: AGAINST ('BACONO' in buzin mode)
Comments
Post a Comment