picky 3.6.1 → 3.6.2
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.
- data/lib/picky/analytics.rb +80 -0
- data/lib/picky/backends/sqlite/db.rb +1 -1
- data/lib/picky/backends/sqlite.rb +1 -1
- data/lib/picky/bundle.rb +13 -10
- data/lib/picky/bundle_indexing.rb +0 -2
- data/lib/picky/categories.rb +1 -1
- data/lib/picky/categories_convenience.rb +15 -0
- data/lib/picky/category.rb +20 -13
- data/lib/picky/category_convenience.rb +16 -0
- data/lib/picky/generators/weights/logarithmic.rb +1 -1
- data/lib/picky/index.rb +5 -9
- data/lib/picky/index_convenience.rb +13 -0
- data/lib/picky/indexes.rb +2 -2
- data/lib/picky/indexes_convenience.rb +11 -0
- data/lib/picky/loader.rb +4 -0
- data/spec/lib/analytics_spec.rb +65 -0
- data/spec/lib/backends/sqlite/db_spec.rb +2 -2
- data/spec/lib/backends/sqlite_spec.rb +26 -26
- data/spec/lib/bundle_spec.rb +0 -1
- data/spec/lib/generators/weights/logarithmic_spec.rb +1 -1
- data/spec/lib/indexed/bundle_realtime_spec.rb +2 -2
- data/spec/lib/indexed/bundle_spec.rb +2 -2
- data/spec/lib/indexing/bundle_spec.rb +1 -1
- data/spec/specific/dynamic_weights_spec.rb +1 -1
- metadata +34 -27
@@ -0,0 +1,80 @@
|
|
1
|
+
module Picky
|
2
|
+
|
3
|
+
# This class is wrapped around indexes
|
4
|
+
# and extracts useful information to be
|
5
|
+
# displayed in beoootiful, live-updating
|
6
|
+
# graphs.
|
7
|
+
#
|
8
|
+
class Analytics
|
9
|
+
|
10
|
+
attr_reader :indexes
|
11
|
+
|
12
|
+
def initialize *indexes
|
13
|
+
@indexes = Indexes.new *indexes
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns the number of tokens in all the inverted indexes.
|
17
|
+
#
|
18
|
+
def tokens
|
19
|
+
total = 0
|
20
|
+
indexes.each_bundle do |bundle|
|
21
|
+
total += bundle.inverted.size
|
22
|
+
end
|
23
|
+
total
|
24
|
+
end
|
25
|
+
|
26
|
+
def ids
|
27
|
+
total = 0
|
28
|
+
indexes.each_bundle do |bundle|
|
29
|
+
total += bundle.inverted.inject(0) { |total, (_, values)| total + values.size }
|
30
|
+
end
|
31
|
+
total
|
32
|
+
end
|
33
|
+
|
34
|
+
# def lengths index
|
35
|
+
# min_ids_length = 1.0/0 # Infinity
|
36
|
+
# max_ids_length = 0
|
37
|
+
# min_key_length = 1.0/0 # Infinity
|
38
|
+
# max_key_length = 0
|
39
|
+
#
|
40
|
+
# key_size, ids_size = 0, 0
|
41
|
+
# bundle.each_pair do |key, ids|
|
42
|
+
# key_size = key.size
|
43
|
+
# if key_size < min_key_length
|
44
|
+
# min_key_length = key_size
|
45
|
+
# else
|
46
|
+
# max_key_length = key_size if key_size > max_key_length
|
47
|
+
# end
|
48
|
+
# key_length_average += key_size
|
49
|
+
#
|
50
|
+
# ids_size = ids.size
|
51
|
+
# if ids_size < min_ids_length
|
52
|
+
# min_ids_length = ids_size
|
53
|
+
# else
|
54
|
+
# max_ids_length = ids_size if ids_size > max_ids_length
|
55
|
+
# end
|
56
|
+
# ids_length_average += ids_size
|
57
|
+
# end
|
58
|
+
# index_size = index.size
|
59
|
+
# key_length_average = key_length_average.to_f / index_size
|
60
|
+
# ids_length_average = ids_length_average.to_f / index_size
|
61
|
+
#
|
62
|
+
# [
|
63
|
+
# Lengths.new(index_size, key_length_average, (min_key_length..max_key_length)),
|
64
|
+
# Lengths.new(index_size, ids_length_average, (min_ids_length..max_ids_length))
|
65
|
+
# ]
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# # Contains an average and a range.
|
69
|
+
# #
|
70
|
+
# class Lengths
|
71
|
+
#
|
72
|
+
# def initialize size, average, range
|
73
|
+
# @size, @average, @range = size, average, range
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data/lib/picky/bundle.rb
CHANGED
@@ -23,8 +23,7 @@ module Picky
|
|
23
23
|
class Bundle
|
24
24
|
|
25
25
|
attr_reader :name,
|
26
|
-
:category
|
27
|
-
:backend
|
26
|
+
:category
|
28
27
|
|
29
28
|
attr_accessor :inverted,
|
30
29
|
:weights,
|
@@ -43,31 +42,35 @@ module Picky
|
|
43
42
|
delegate :[], :[]=, :to => :configuration
|
44
43
|
delegate :index_directory, :to => :category
|
45
44
|
|
46
|
-
def initialize name, category,
|
45
|
+
def initialize name, category, weights_strategy, partial_strategy, similarity_strategy, options = {}
|
47
46
|
@name = name
|
48
47
|
@category = category
|
49
48
|
|
50
49
|
# TODO Tidy up a bit.
|
51
50
|
#
|
52
|
-
@key_format = options
|
51
|
+
@key_format = options.delete :key_format
|
52
|
+
@backend = options.delete :backend
|
53
53
|
|
54
54
|
@weights_strategy = weights_strategy
|
55
55
|
@partial_strategy = partial_strategy
|
56
56
|
@similarity_strategy = similarity_strategy
|
57
57
|
|
58
|
-
reset_backend
|
58
|
+
reset_backend
|
59
59
|
end
|
60
60
|
def identifier
|
61
61
|
"#{category.identifier}:#{name}"
|
62
62
|
end
|
63
63
|
|
64
|
-
#
|
64
|
+
# If no specific backend has been set,
|
65
|
+
# uses the category's backend.
|
65
66
|
#
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
def backend
|
68
|
+
@backend || category.backend
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes all necessary indexes from the backend.
|
69
72
|
#
|
70
|
-
def reset_backend
|
73
|
+
def reset_backend
|
71
74
|
# Extract specific indexes from backend.
|
72
75
|
#
|
73
76
|
# TODO Clean up all related.
|
data/lib/picky/categories.rb
CHANGED
data/lib/picky/category.rb
CHANGED
@@ -5,7 +5,8 @@ module Picky
|
|
5
5
|
attr_reader :name,
|
6
6
|
:exact,
|
7
7
|
:partial,
|
8
|
-
:prepared
|
8
|
+
:prepared,
|
9
|
+
:backend
|
9
10
|
|
10
11
|
# Mandatory params:
|
11
12
|
# * name: Category name to use as identifier and file names.
|
@@ -32,10 +33,13 @@ module Picky
|
|
32
33
|
@source = options[:source]
|
33
34
|
@from = options[:from]
|
34
35
|
@tokenizer = options[:tokenizer]
|
35
|
-
|
36
|
-
|
36
|
+
|
37
|
+
@key_format = options.delete :key_format
|
38
|
+
@backend = options.delete :backend
|
39
|
+
|
37
40
|
@qualifiers = extract_qualifiers_from options
|
38
|
-
|
41
|
+
|
42
|
+
# @symbols = options[:use_symbols] || index.use_symbols? # TODO Symbols.
|
39
43
|
|
40
44
|
weights = options[:weights] || Generators::Weights::Default
|
41
45
|
partial = options[:partial] || Generators::Partial::Default
|
@@ -44,11 +48,11 @@ module Picky
|
|
44
48
|
no_partial = Generators::Partial::None.new
|
45
49
|
no_similarity = Generators::Similarity::None.new
|
46
50
|
|
47
|
-
@exact = Bundle.new :exact, self,
|
51
|
+
@exact = Bundle.new :exact, self, weights, no_partial, similarity, options
|
48
52
|
if partial.use_exact_for_partial?
|
49
53
|
@partial = Wrappers::Bundle::ExactPartial.new @exact
|
50
54
|
else
|
51
|
-
@partial = Bundle.new :partial, self,
|
55
|
+
@partial = Bundle.new :partial, self, weights, partial, no_similarity, options
|
52
56
|
end
|
53
57
|
|
54
58
|
@prepared = Backends::Memory::Text.new prepared_index_path
|
@@ -69,15 +73,18 @@ module Picky
|
|
69
73
|
timed_exclaim %Q{"#{identifier}": Generated -> #{index_directory.gsub("#{PICKY_ROOT}/", '')}.}
|
70
74
|
end
|
71
75
|
|
72
|
-
#
|
76
|
+
# Returns the backend.
|
73
77
|
#
|
74
|
-
#
|
78
|
+
# If no specific backend has been defined for this
|
75
79
|
#
|
76
|
-
def
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
80
|
+
def backend
|
81
|
+
@backend || @index.backend
|
82
|
+
end
|
83
|
+
# Resets backends in both bundles.
|
84
|
+
#
|
85
|
+
def reset_backend
|
86
|
+
exact.reset_backend
|
87
|
+
partial.reset_backend
|
81
88
|
end
|
82
89
|
|
83
90
|
# Index name.
|
data/lib/picky/index.rb
CHANGED
@@ -91,7 +91,9 @@ module Picky
|
|
91
91
|
|
92
92
|
delegate :[],
|
93
93
|
:dump,
|
94
|
-
:
|
94
|
+
:each,
|
95
|
+
:inject,
|
96
|
+
:reset_backend,
|
95
97
|
:to => :categories
|
96
98
|
|
97
99
|
# Create a new index with a given source.
|
@@ -132,18 +134,12 @@ module Picky
|
|
132
134
|
#
|
133
135
|
def backend backend = nil
|
134
136
|
if backend
|
135
|
-
@backend =
|
137
|
+
@backend = backend
|
138
|
+
reset_backend
|
136
139
|
else
|
137
140
|
@backend ||= Backends::Memory.new
|
138
141
|
end
|
139
142
|
end
|
140
|
-
# TODO Rewrite such that reset_backend just sets the
|
141
|
-
# lazily evaluated backend to nil.
|
142
|
-
#
|
143
|
-
def reset_backend backend
|
144
|
-
categories.reset_backend backend
|
145
|
-
backend
|
146
|
-
end
|
147
143
|
|
148
144
|
# TODO Symbols.
|
149
145
|
#
|
data/lib/picky/indexes.rb
CHANGED
@@ -16,11 +16,11 @@ module Picky
|
|
16
16
|
:to => :indexes
|
17
17
|
|
18
18
|
each_delegate :reindex,
|
19
|
-
:each_category,
|
20
19
|
:to => :indexes
|
21
20
|
|
22
|
-
def initialize
|
21
|
+
def initialize *indexes
|
23
22
|
clear_indexes
|
23
|
+
indexes.each { |index| register index }
|
24
24
|
end
|
25
25
|
|
26
26
|
# Return the Indexes instance.
|
data/lib/picky/loader.rb
CHANGED
@@ -209,20 +209,24 @@ module Picky
|
|
209
209
|
load_relative 'category_indexed'
|
210
210
|
load_relative 'category_indexing'
|
211
211
|
load_relative 'category_realtime'
|
212
|
+
load_relative 'category_convenience'
|
212
213
|
|
213
214
|
load_relative 'categories'
|
214
215
|
load_relative 'categories_indexed'
|
215
216
|
load_relative 'categories_indexing'
|
216
217
|
load_relative 'categories_realtime'
|
218
|
+
load_relative 'categories_convenience'
|
217
219
|
|
218
220
|
load_relative 'indexes'
|
219
221
|
load_relative 'indexes_indexed'
|
220
222
|
load_relative 'indexes_indexing'
|
223
|
+
load_relative 'indexes_convenience'
|
221
224
|
|
222
225
|
load_relative 'index'
|
223
226
|
load_relative 'index_indexed'
|
224
227
|
load_relative 'index_indexing'
|
225
228
|
load_relative 'index_realtime'
|
229
|
+
load_relative 'index_convenience'
|
226
230
|
|
227
231
|
# Results.
|
228
232
|
#
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
# Not loaded by default.
|
6
|
+
#
|
7
|
+
require File.expand_path '../../../lib/picky/analytics', __FILE__
|
8
|
+
|
9
|
+
describe Picky::Analytics do
|
10
|
+
|
11
|
+
attr_reader :index1, :index2
|
12
|
+
|
13
|
+
Item = Struct.new :id, :text
|
14
|
+
|
15
|
+
before(:all) do
|
16
|
+
@index1 = Picky::Index.new :index1 do
|
17
|
+
source [
|
18
|
+
Item.new(1, 'test one'),
|
19
|
+
Item.new(2, 'test two'),
|
20
|
+
]
|
21
|
+
category :text
|
22
|
+
end
|
23
|
+
@index1.index
|
24
|
+
@index1
|
25
|
+
|
26
|
+
@index2 = Picky::Index.new :index2 do
|
27
|
+
source [
|
28
|
+
Item.new(3, 'test three'),
|
29
|
+
Item.new(4, 'test four'),
|
30
|
+
]
|
31
|
+
category :text
|
32
|
+
end
|
33
|
+
@index2.index
|
34
|
+
@index2
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:analytics) { described_class.new index1, index2 }
|
38
|
+
|
39
|
+
it 'can be initialized' do
|
40
|
+
analytics # La-zee
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'saves the indexes' do
|
44
|
+
analytics.indexes.should be_kind_of(Picky::Indexes)
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'tokens' do
|
48
|
+
it 'offers the method' do
|
49
|
+
analytics.tokens
|
50
|
+
end
|
51
|
+
it 'calculates the number of tokens correctly' do
|
52
|
+
analytics.tokens.should == 24
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'ids' do
|
57
|
+
it 'offers the method' do
|
58
|
+
analytics.ids
|
59
|
+
end
|
60
|
+
it 'calculates the number of ids correctly' do
|
61
|
+
analytics.ids.should == 32
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
require 'sqlite3'
|
4
4
|
|
5
|
-
describe Picky::Backends::
|
5
|
+
describe Picky::Backends::SQLite::DB do
|
6
6
|
|
7
7
|
context 'hash-based indexes' do
|
8
8
|
let(:db) { described_class.new 'some/cache/path/to/file' }
|
@@ -72,7 +72,7 @@ describe Picky::Backends::Sqlite::DB do
|
|
72
72
|
|
73
73
|
describe 'to_s' do
|
74
74
|
it 'returns the cache path with the default file extension' do
|
75
|
-
db.to_s.should == 'Picky::Backends::
|
75
|
+
db.to_s.should == 'Picky::Backends::SQLite::DB(some/cache/path/to/file.sqlite3)'
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Picky::Backends::
|
3
|
+
describe Picky::Backends::SQLite do
|
4
4
|
|
5
5
|
context 'with options' do
|
6
6
|
before(:each) do
|
7
|
-
@backend = described_class.new inverted: Picky::Backends::
|
8
|
-
weights: Picky::Backends::
|
9
|
-
similarity: Picky::Backends::
|
10
|
-
configuration: Picky::Backends::
|
7
|
+
@backend = described_class.new inverted: Picky::Backends::SQLite::DB.new(:unimportant),
|
8
|
+
weights: Picky::Backends::SQLite::DB.new(:unimportant),
|
9
|
+
similarity: Picky::Backends::SQLite::DB.new(:unimportant),
|
10
|
+
configuration: Picky::Backends::SQLite::DB.new(:unimportant)
|
11
11
|
|
12
12
|
@backend.stub! :timed_exclaim
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
describe 'create_...' do
|
16
16
|
[
|
17
|
-
[:inverted, Picky::Backends::
|
18
|
-
[:weights, Picky::Backends::
|
19
|
-
[:similarity, Picky::Backends::
|
20
|
-
[:configuration, Picky::Backends::
|
17
|
+
[:inverted, Picky::Backends::SQLite::DB],
|
18
|
+
[:weights, Picky::Backends::SQLite::DB],
|
19
|
+
[:similarity, Picky::Backends::SQLite::DB],
|
20
|
+
[:configuration, Picky::Backends::SQLite::DB]
|
21
21
|
].each do |type, kind|
|
22
22
|
it "creates and returns a(n) #{type} index" do
|
23
23
|
@backend.send(:"create_#{type}",
|
@@ -27,23 +27,23 @@ describe Picky::Backends::Sqlite do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
context 'with lambda options' do
|
32
32
|
before(:each) do
|
33
|
-
@backend = described_class.new inverted: ->(bundle){ Picky::Backends::
|
34
|
-
weights: ->(bundle){ Picky::Backends::
|
35
|
-
similarity: ->(bundle){ Picky::Backends::
|
36
|
-
configuration: ->(bundle){ Picky::Backends::
|
33
|
+
@backend = described_class.new inverted: ->(bundle){ Picky::Backends::SQLite::DB.new(bundle.index_path(:inverted)) },
|
34
|
+
weights: ->(bundle){ Picky::Backends::SQLite::DB.new(bundle.index_path(:weights)) },
|
35
|
+
similarity: ->(bundle){ Picky::Backends::SQLite::DB.new(bundle.index_path(:similarity)) },
|
36
|
+
configuration: ->(bundle){ Picky::Backends::SQLite::DB.new(bundle.index_path(:configuration)) }
|
37
37
|
|
38
38
|
@backend.stub! :timed_exclaim
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
describe 'create_...' do
|
42
42
|
[
|
43
|
-
[:inverted, Picky::Backends::
|
44
|
-
[:weights, Picky::Backends::
|
45
|
-
[:similarity, Picky::Backends::
|
46
|
-
[:configuration, Picky::Backends::
|
43
|
+
[:inverted, Picky::Backends::SQLite::DB],
|
44
|
+
[:weights, Picky::Backends::SQLite::DB],
|
45
|
+
[:similarity, Picky::Backends::SQLite::DB],
|
46
|
+
[:configuration, Picky::Backends::SQLite::DB]
|
47
47
|
].each do |type, kind|
|
48
48
|
it "creates and returns a(n) #{type} index" do
|
49
49
|
to_a_able_stub = Object.new
|
@@ -60,13 +60,13 @@ describe Picky::Backends::Sqlite do
|
|
60
60
|
|
61
61
|
@backend.stub! :timed_exclaim
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
describe 'create_...' do
|
65
65
|
[
|
66
|
-
[:inverted, Picky::Backends::
|
67
|
-
[:weights, Picky::Backends::
|
68
|
-
[:similarity, Picky::Backends::
|
69
|
-
[:configuration, Picky::Backends::
|
66
|
+
[:inverted, Picky::Backends::SQLite::DB],
|
67
|
+
[:weights, Picky::Backends::SQLite::DB],
|
68
|
+
[:similarity, Picky::Backends::SQLite::DB],
|
69
|
+
[:configuration, Picky::Backends::SQLite::DB]
|
70
70
|
].each do |type, kind|
|
71
71
|
it "creates and returns a(n) #{type} index" do
|
72
72
|
@backend.send(:"create_#{type}",
|
@@ -75,7 +75,7 @@ describe Picky::Backends::Sqlite do
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
describe "ids" do
|
80
80
|
before(:each) do
|
81
81
|
@combination1 = stub :combination1
|
data/spec/lib/bundle_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe Picky::Generators::Weights::Logarithmic do
|
|
18
18
|
logarithmic.weight_for(1).should == 0
|
19
19
|
end
|
20
20
|
it 'is log(x) for x' do
|
21
|
-
logarithmic.weight_for(1234).should == Math.log(1234)
|
21
|
+
logarithmic.weight_for(1234).should == Math.log(1234).round(3)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -9,7 +9,7 @@ describe Picky::Bundle do
|
|
9
9
|
@weights = Picky::Generators::Weights::Default
|
10
10
|
@partial = Picky::Generators::Partial::Default
|
11
11
|
@similarity = Picky::Generators::Similarity::DoubleMetaphone.new 3
|
12
|
-
@bundle = described_class.new :some_name, @category,
|
12
|
+
@bundle = described_class.new :some_name, @category, @weights, @partial, @similarity
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'is by default empty' do
|
@@ -32,7 +32,7 @@ describe Picky::Bundle do
|
|
32
32
|
|
33
33
|
@bundle.realtime_mapping.should == { 1 => [:title], 2 => [:title] }
|
34
34
|
@bundle.inverted.should == { :title => [2,1] }
|
35
|
-
@bundle.weights.should == { :title => 0.
|
35
|
+
@bundle.weights.should == { :title => 0.693 }
|
36
36
|
@bundle.similarity.should == { :TTL => [:title] }
|
37
37
|
end
|
38
38
|
it 'works correctly' do
|
@@ -9,7 +9,7 @@ describe Picky::Bundle do
|
|
9
9
|
@weights = stub :weights, :saved? => true
|
10
10
|
@partial = stub :partial, :saved? => true
|
11
11
|
@similarity = stub :similarity, :saved? => true
|
12
|
-
@bundle = described_class.new :some_name, @category,
|
12
|
+
@bundle = described_class.new :some_name, @category, @weights, @partial, @similarity
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'to_s' do
|
@@ -160,7 +160,7 @@ describe Picky::Bundle do
|
|
160
160
|
|
161
161
|
@weights = stub :weights, :saved? => true
|
162
162
|
@partial = stub :partial, :saved? => true
|
163
|
-
@bundle = described_class.new :some_name, @category,
|
163
|
+
@bundle = described_class.new :some_name, @category, @weights, @partial, :similarity
|
164
164
|
end
|
165
165
|
it 'should initialize the index correctly' do
|
166
166
|
@bundle.backend_inverted.should be_kind_of(Picky::Backends::Memory::JSON)
|
@@ -8,7 +8,7 @@ describe Picky::Bundle do
|
|
8
8
|
@weights = Picky::Weights::Logarithmic.new
|
9
9
|
@similarity = Picky::Similarity::DoubleMetaphone.new 3
|
10
10
|
end
|
11
|
-
let(:bundle) { described_class.new :some_name, @category,
|
11
|
+
let(:bundle) { described_class.new :some_name, @category, @weights, :some_partial, @similarity }
|
12
12
|
|
13
13
|
describe 'identifier' do
|
14
14
|
it 'is correct' do
|
@@ -28,7 +28,7 @@ describe "Weights" do
|
|
28
28
|
try.search("text1:ohai").allocations.first.score.should == 0.0
|
29
29
|
try.search("text2:hello").allocations.first.score.should == 3.14
|
30
30
|
try.search("text3:world").allocations.first.score.should == 5
|
31
|
-
try.search("text4:kthxbye").allocations.first.score.should == 0.
|
31
|
+
try.search("text4:kthxbye").allocations.first.score.should == 0.693
|
32
32
|
|
33
33
|
try_with_boosts = Picky::Search.new index do
|
34
34
|
boost [:text1] => +7.65,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70240308070780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70240308070780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: picky-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &70240308070180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.6.
|
32
|
+
version: 3.6.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70240308070180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rack
|
38
|
-
requirement: &
|
38
|
+
requirement: &70240308069700 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70240308069700
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack_fast_escape
|
49
|
-
requirement: &
|
49
|
+
requirement: &70240308069140 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70240308069140
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: text
|
60
|
-
requirement: &
|
60
|
+
requirement: &70240308067860 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70240308067860
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yajl-ruby
|
71
|
-
requirement: &
|
71
|
+
requirement: &70240308066300 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70240308066300
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: activesupport
|
82
|
-
requirement: &
|
82
|
+
requirement: &70240308080860 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '3.0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70240308080860
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: activerecord
|
93
|
-
requirement: &
|
93
|
+
requirement: &70240308078980 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '3.0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70240308078980
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: unicorn
|
104
|
-
requirement: &
|
104
|
+
requirement: &70240308077500 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70240308077500
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: sinatra
|
115
|
-
requirement: &
|
115
|
+
requirement: &70240308075680 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70240308075680
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: redis
|
126
|
-
requirement: &
|
126
|
+
requirement: &70240308074260 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70240308074260
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: mysql
|
137
|
-
requirement: &
|
137
|
+
requirement: &70240308089700 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70240308089700
|
146
146
|
description: Fast Ruby semantic text search engine with comfortable single field interface.
|
147
147
|
email: florian.hanke+picky@gmail.com
|
148
148
|
executables:
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/picky/adapters/rack/live_parameters.rb
|
157
157
|
- lib/picky/adapters/rack/search.rb
|
158
158
|
- lib/picky/adapters/rack.rb
|
159
|
+
- lib/picky/analytics.rb
|
159
160
|
- lib/picky/analyzer.rb
|
160
161
|
- lib/picky/application.rb
|
161
162
|
- lib/picky/backends/backend.rb
|
@@ -182,10 +183,12 @@ files:
|
|
182
183
|
- lib/picky/bundle_realtime.rb
|
183
184
|
- lib/picky/calculations/location.rb
|
184
185
|
- lib/picky/categories.rb
|
186
|
+
- lib/picky/categories_convenience.rb
|
185
187
|
- lib/picky/categories_indexed.rb
|
186
188
|
- lib/picky/categories_indexing.rb
|
187
189
|
- lib/picky/categories_realtime.rb
|
188
190
|
- lib/picky/category.rb
|
191
|
+
- lib/picky/category_convenience.rb
|
189
192
|
- lib/picky/category_indexed.rb
|
190
193
|
- lib/picky/category_indexing.rb
|
191
194
|
- lib/picky/category_realtime.rb
|
@@ -226,6 +229,7 @@ files:
|
|
226
229
|
- lib/picky/generators/weights/strategy.rb
|
227
230
|
- lib/picky/helpers/measuring.rb
|
228
231
|
- lib/picky/index.rb
|
232
|
+
- lib/picky/index_convenience.rb
|
229
233
|
- lib/picky/index_indexed.rb
|
230
234
|
- lib/picky/index_indexing.rb
|
231
235
|
- lib/picky/index_realtime.rb
|
@@ -233,6 +237,7 @@ files:
|
|
233
237
|
- lib/picky/indexers/parallel.rb
|
234
238
|
- lib/picky/indexers/serial.rb
|
235
239
|
- lib/picky/indexes.rb
|
240
|
+
- lib/picky/indexes_convenience.rb
|
236
241
|
- lib/picky/indexes_indexed.rb
|
237
242
|
- lib/picky/indexes_indexing.rb
|
238
243
|
- lib/picky/interfaces/live_parameters.rb
|
@@ -286,6 +291,7 @@ files:
|
|
286
291
|
- spec/lib/adapters/rack/base_spec.rb
|
287
292
|
- spec/lib/adapters/rack/live_parameters_spec.rb
|
288
293
|
- spec/lib/adapters/rack/query_spec.rb
|
294
|
+
- spec/lib/analytics_spec.rb
|
289
295
|
- spec/lib/analyzer_spec.rb
|
290
296
|
- spec/lib/application_spec.rb
|
291
297
|
- spec/lib/backends/backend_spec.rb
|
@@ -414,6 +420,7 @@ test_files:
|
|
414
420
|
- spec/lib/adapters/rack/base_spec.rb
|
415
421
|
- spec/lib/adapters/rack/live_parameters_spec.rb
|
416
422
|
- spec/lib/adapters/rack/query_spec.rb
|
423
|
+
- spec/lib/analytics_spec.rb
|
417
424
|
- spec/lib/analyzer_spec.rb
|
418
425
|
- spec/lib/application_spec.rb
|
419
426
|
- spec/lib/backends/backend_spec.rb
|