Repository navigation
Indexing configuration
Indexing options define what Picky does with your data. E.g. where does it split the data text into words to index?
Indexing is defined in app/application.rb like all other index specific options.
Define the default indexing behaviour by calling default_indexing(options) with various options (described below, in the new Ruby 1.9 hash style):
class PickySearch < Application # ... default_indexing removes_characters: /[^a-zA-Z0-9\.]/, stopwords: /\b(and|or|in|on|is|has)\b/, splits_text_on: /\s/, removes_characters_after_splitting: /\./, substitutes_characters_with: CharacterSubstituters::WestEuropean.new, normalizes_words: [ [/(.*)hausen/, '1円hn'], [/\b(\w*)str(eet)?/, '1円st'] ] # ... end
This example does:
- not remove the abc or numbers.
- remove in the query text the words and, or, in, on, is, and has. (If they are not the only word to occur in the data)
- split query text on whitespaces. "fish market" would be indexed as "fish", "market".
- remove characters after splitting in the same mode as removes_characters, but for each split word.
- substitute certain west european special characters, e.g. "ü" to "ue", or "ø" to "o". (if you have them indexed that way)
- normalize "Petershausen" (and similar) to "Petershn", and "...street", "...str" to "...st".
Note: The options are almost the same as in the Querying Configuration.
The options are:
- removes_characters(regexp)
- stopwords(regexp)
- splits_text_on(regexp)
- removes_characters_after_splitting(regexp)
- substitutes_characters_with(substituter)
- normalizes_words(array of [regexp, replacement])
By default, there is only one of these defined:
splits_text_on(/\s/)
So, if none of the above options is defined, Picky splits on whitespaces (\s).
Define how the text is split into tokens. Tokens are what Picky works with and tries to find in indexes.
So, if you define splits_text_on(/\s/), then Picky will split input text "my beautiful data" into tokens [:my, :beautiful, :data].