Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 87 lines (49 sloc) 1.94 kB
9beb09c @floere + first step towards an API draft
authored
1 h1. APIs in Picky
2
3 This is the reference document for all the APIs that can be used in Picky.
4
5 It denotes several areas where you can plug into Picky.
6
7 h2. Tokenizer
8
9 Has methods
10
11 * @tokenize(text)@ => @[[:token1, :token2, ...], ["Original1", "Original2", ...]]@ (2-D array of the tokens and the original texts)
12
13 Accepted by
14
15 * @Sinatra::Application#indexing@
16 * @Sinatra::Application#searching@
17 * @Picky::Index#indexing@
18 * @Picky::Search#searching@
19 * @Picky::Category.new(tokenizer: tokenizer_instance)@
20
21 h2. CharacterSubstituter
22
23 Has methods
24
25 * @substitute(text)@ => @new text@ (with characters replaced)
26
27 Accepted as
28
29 * option @substitutes_characters_with@ for @indexing@ and @searching@.
30
31 h2. Backends
32
93330de @floere + TODO
authored
33 Have methods
9beb09c @floere + first step towards an API draft
authored
34
93330de @floere + TODO
authored
35 # TODO
9beb09c @floere + first step towards an API draft
authored
36
37 Accepted by
38
39 * @Picky::Index#backend(backend_instance)@
40
41 h2. Sources
42
43 Has methods
44
45 * @each(&block)@ yields @objects@ (that respond to methods listed in the categories, or in the categories' @from@ option)
46
47 h2. Weight
48
49 Has methods
50
51 * @weight_for(amount_of_ids)@ => @float@ (a weight)
52
5110e1a @floere + Renamed weights category option to weight
authored
53 Accepted as option @weight@ for the @category@.
9beb09c @floere + first step towards an API draft
authored
54
55 h2. Partial
56
57 Has methods
58
59 * @each_partial(token, &block)@ yields each @partialized token@
60
61 Accepted as option @partial@ for the @category@.
62
63 h2. Similarity
64
65 Has methods
66
67 * @encoded(token)@ => @encoded token@
68
69 Accepted as option @similarity@ for the @category@.
70
71 h2. Searches
72
73 Has methods
74
75 * @Picky::Search#search(text, ids = 20, offset = 0)@ => @Picky::Results@ (an instance)
76
77 h2. Results
78
79 Has methods
80
81 * @prepare!@ => @unimportant@ (prepares the search results, called by the Picky search)
82 * @ids(amount = 20)@ => @[id1, id2, id3, ...]@ (a list of ids in order of importance)
83 * @total@ => @1234@ (the total number of - calculated - results)
84 * @duration@ => @1.234@ (a float)
85 * @to_hash@ => @{...}@ (a hash representation of the results)
86 * @to_json@ -> @"{...}"@ (a json representation of the hash representation of the results)
87 * @to_s@ => @log output@ (a string for log output)
Something went wrong with that request. Please try again.