Sha256: 475e73d1deefbf7e9d5ef5b6c4541e09d77f7e0bc763c6faae40d59700ed6e1a
Contents?: true
Size: 1.72 KB
Versions: 6
Compression:
Stored size: 1.72 KB
Contents
# encoding: utf-8 # require File.expand_path '../logging', __FILE__ # 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 BookSearch < Picky::Application # So we don't have to write Picky:: # in front of everything. # include Picky # 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 = Indexes::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 books = Search.new books_index do boost [:title, :author] => +3, [:title] => +1 end route %r{\A/books\Z} => books end
Version data entries
6 entries across 6 versions & 1 rubygems