Skip to content

leonardoeloy/arel-fulltext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arel Full-Text Search Support Build Status Dependency Status

Adds 'native' full-text search support to Arel.

Usage

In order to produce this query (MySQL Full-Text syntax):

SELECT * FROM people
WHERE MATCH (name) AGAINST ('expression')

You could use this Arel construct:

people = Arel::Table.new(:people)
expr = people[:name].match('expression')

MySQL

Arel Full-Text only supports MySQL currently. Open an issue if you wish to add support to a different database.

Search Modifiers

You can also include search modifiers to further optimize your query.

Boolean Mode

people = Arel::Table.new(:people)
expr = people[:name].match('expression', boolean_mode: true)

Will result in:

SELECT * FROM people
WHERE MATCH (name) AGAINST ('expression' IN BOOLEAN MODE)

Query Expansion

people = Arel::Table.new(:people)
expr = people[:name].match('expression', query_expansion: true)

Will result in:

SELECT * FROM people
WHERE MATCH (name) AGAINST ('expression' WITH QUERY EXPANSION)

Adding Full-Text Index to MySQL

CREATE FULLTEXT INDEX index_id ON table (column);

License

Arel Full-Text is released under a MIT License.

Portions of this software are licensed from Arel, copyrighted 2007-2010 to Nick Kallen, Bryan Helmkamp, Emilio Tagua, Aaron Patterson.

About

Adds 'native' full-text search support to Arel.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages