picky 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # TODO Adapt the generated example
4
- # (a library books finder) to what you need.
5
- #
6
- # Check the Wiki http://github.com/floere/picky/wiki for more options.
7
- # Ask me or the google group if you have questions or specific requests.
8
- #
9
- class PickySearch < Application
10
-
11
- # Indexing: How text is indexed.
12
- #
13
- default_indexing removes_characters: /[^a-zA-Z0-9\s\/\-\"\&\.]/,
14
- stopwords: /\b(and|the|of|it|in|for)\b/,
15
- splits_text_on: /[\s\/\-\"\&\.]/
16
-
17
- # Querying: How query text is handled.
18
- #
19
- default_querying removes_characters: /[^a-zA-Z0-9\s\/\-\,\&\"\~\*\:]/, # Picky needs control chars *"~: to pass through.
20
- stopwords: /\b(and|the|of|it|in|for)\b/,
21
- splits_text_on: /[\s\/\-\,\&]+/,
22
-
23
- maximum_tokens: 5, # Amount of tokens passing into a query (5 = default).
24
- substitutes_characters_with: CharacterSubstituters::WestEuropean.new # Normalizes special user input, Ä -> Ae, ñ -> n etc.
25
-
26
- # Define an index. Use a database etc. source?
27
- # See http://github.com/floere/picky/wiki/Sources-Configuration#sources
28
- #
29
- books_index = index :books, Sources::CSV.new(:title, :author, :year, file: 'app/library.csv')
30
- books_index.define_category :title,
31
- similarity: Similarity::Phonetic.new(3), # Up to three similar title word indexed (default: No similarity).
32
- partial: Partial::Substring.new(from: 1) # Indexes substrings upwards from character 1 (default: -3),
33
- # You'll find "picky" even when entering just a "p".
34
- books_index.define_category :author,
35
- partial: Partial::Substring.new(from: 1)
36
- books_index.define_category :year,
37
- partial: Partial::None.new # Partial substring searching on the year does not make
38
- # much sense, neither does similarity.
39
-
40
- query_options = { :weights => { [:title, :author] => +3, [:title] => +1 } } # +/- points for ordered combinations.
41
-
42
- full_books = Query::Full.new books_index, query_options # A Full query returns ids, combinations, and counts.
43
- live_books = Query::Live.new books_index, query_options # A Live query does return all that Full returns, except ids.
44
-
45
- route %r{\A/books/full\Z} => full_books # Routing is simple: url_path_regexp => query
46
- route %r{\A/books/live\Z} => live_books #
47
-
48
- # Note: You can pass a query multiple indexes and it will query in all of them.
49
-
50
- end
@@ -1,13 +0,0 @@
1
- # Just an example, see application.rb on how this file is used.
2
- #
3
- # Note: ActiveRecord is used. Sorry.
4
- #
5
- # TODO Configure the database adapter
6
- # or ignore and use a csv source.
7
- #
8
- adapter: mysql
9
- host: localhost
10
- username: root
11
- password:
12
- database: your_database # Load this configuration and use a DB source in app/application.rb.
13
- encoding: utf8