-
Notifications
You must be signed in to change notification settings - Fork 49
Charactersubstituters configuration
Character substituters tell an indexer or query how to replace funky characters, like “ç”.
Example
Possible CharacterSubstituters
WestEuropean
The option substitutes_characters_with character_substituter is defined for methods default_indexing
and default_querying
.
class PickySearch < Application
default_indexing substitutes_characters_with: CharacterSubstituters::WestEuropean.new
default_querying substitutes_characters_with: CharacterSubstituters::WestEuropean.new
end
The substitutes_characters_with option defines how characters are handled. If none is defined, no characters are substituted.
You can use join statements etc. (The :file option points to a yml with an active record config hash)
Then, reference your columns by their names in the catgories:
index = :name, Sources::DB.new('SELECT id, title, author, isbn13 as isbn FROM books', :file => 'app/db.yml')
index.category :isbn
index.category :title
Sources::CSV.new(:title, :author, :isbn, :year, :publisher, :subjects, :file => 'app/library.csv')
The first column in the CSV needs to be the id. The others are assumed to be in the order you provide.
Sources::Delicious.new('username', 'password')
Delicious then provides a selection of categories: title, tags, url.
If needed you can provide each category with its own source.
index = :name, Sources::DB.new('SELECT id, title, author, isbn13 as isbn FROM books', :file => 'app/db.yml')
index.category :isbn, :source => Sources::CSV.new(:isbn, :file => 'app/isbn.csv')
index.category :title, :source => Sources::Delicious.new('username', 'password')
But normally you won’t need this. Don’t hesitate to ask if you don’t see any other possibility than using this.