Sha256: ce14e0d9d66ca2b7004aa6f86aefddf8e8a2298be08a35a7cb3e6c856ac812b0
Contents?: true
Size: 1.55 KB
Versions: 5
Compression:
Stored size: 1.55 KB
Contents
# encoding: utf-8 # # TODO Adapt the generated example # (a library books finder) to what you need. # # Questions? Mail me, IRC #picky, the google group, http://github.com/floere/picky/wiki. # class PickySearch < Application # How text is indexed. Move to Index block to make it index specific. # indexing removes_characters: /[^a-zA-Z0-9\s\/\-\_\:\"\&\.]/i, stopwords: /\b(and|the|of|it|in|for)\b/i, splits_text_on: /[\s\/\-\_\:\"\&\/]/ # How query text is preprocessed. Move to Search block to make it search specific. # searching removes_characters: /[^a-zA-Z0-9\s\/\-\_\&\.\"\~\*\:\,]/i, # Picky needs control chars *"~:, to pass through. stopwords: /\b(and|the|of|it|in|for)\b/i, splits_text_on: /[\s\/\-\&]+/, maximum_tokens: 5, # Amount of tokens used in a search (5 = default). substitutes_characters_with: CharacterSubstituters::WestEuropean.new # Normalizes special user input, Ä -> Ae, ñ -> n etc. books_index = Index::Memory.new :books do source Sources::CSV.new(:title, :author, :year, file: "data/#{PICKY_ENVIRONMENT}/library.csv") category :title, similarity: Similarity::DoubleMetaphone.new(3), # Default is no similarity. partial: Partial::Substring.new(from: 1) # Default is from: -3. category :author, partial: Partial::Substring.new(from: 1) category :year, partial: Partial::None.new end route %r{\A/books\Z} => Search.new(books_index) do boost [:title, :author] => +3, [:title] => +1 end end
Version data entries
5 entries across 5 versions & 1 rubygems