-
Notifications
You must be signed in to change notification settings - Fork 49
Configuration Examples
floere edited this page Dec 16, 2011
·
6 revisions
Here are some of the many configurations.
indexing removes_characters: /[^äöüa-zA-Z0-9\s\/\-\"\&\.]/i,
stopwords: /\b(and|the|or|on|of|in|is|to|from|as|at|an)\b/i,
splits_text_on: /[\s\/\-\"\&\/]/,
removes_characters_after_splitting: /[\.]/,
normalizes_words: [[/\$(\w+)/i, '\1 dollars']],
rejects_token_if: lambda { |token| token.blank? || token == :hello },
case_sensitive: false,
substitutes_characters_with: CharacterSubstituters::WestEuropean.new
Picky::Index.new(:special_indexing) do
source { Book.order('title ASC') }
indexing removes_characters: /[^äöüd-zD-Z0-9\s\/\-\"\&\.]/i, # a-c, A-C are removed
splits_text_on: /[\s\/\-\"\&\/]/
category :title,
qualifiers: [:t, :title, :titre],
partial: Partial::Substring.new(from: 1),
similarity: Similarity::DoubleMetaphone.new(2)
end
querying removes_characters: /[^ïôåñëäöüa-zA-Z0-9\s\/\-\,\&\.\"\~\*\:]/i,
stopwords: /\b(and|the|or|on|of|in|is|to|from|as|at|an)\b/i,
splits_text_on: /[\s\/\-\,\&\/]/,
removes_characters_after_splitting: //,
case_sensitive: true,
maximum_tokens: 5,
substitutes_characters_with: CharacterSubstituters::WestEuropean.new
Picky::Search.new books_index do
searching removes_characters: /[buks]/i,
stopwords: /\b(and|the|or|on|of|in|is|to|from|as|at|an)\b/i
end
Picky::Index.new(:books, result_identifier: 'Books') do
source { Book.order('isbn ASC') }
category :title,
qualifiers: [:t, :title, :titre],
partial: Partial::Substring.new(from: 1),
similarity: Similarity::DoubleMetaphone.new(2)
category :author,
qualifiers: [:a, :author, :auteur],
partial: Partial::Substring.new(from: -2)
category :year,
qualifiers: [:y, :year, :annee],
partial: Partial::None.new
category :publisher, qualifiers: [:p, :publisher]
category :subjects, qualifiers: [:s, :subject]
end
See Sinatra.