xapian_db 1.3.2 → 1.3.3
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +10 -0
- data/README.rdoc +13 -11
- data/lib/xapian_db/config.rb +20 -15
- data/lib/xapian_db/query_parser.rb +1 -5
- data/lib/xapian_db/railtie.rb +25 -6
- metadata +27 -52
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e2a9d352e0fa6f589c5296ea5ed0c25c050595c0
|
4
|
+
data.tar.gz: 359d8dd4cfc388bafe0fba2348ddd1a588ded103
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 315ca9a190b3d69b17ee58c9a768842a9fa6b57b7a2fcaf6e58dde4fd6ce1881103efb63d4247ea2d011d805229febf5a92220abbcbcbedd0fca624f976a7c9b
|
7
|
+
data.tar.gz: 7c87c96b7e63d2ae451ef5b7d7630ce4a9c8a12da80a9faac226983c27dd66da8b4deec50c990712e80a68d40cf2b0c50ed0bb92b7aa1a0bafbcc73a9426838e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
##1.3.3 (June 23th, 2013)
|
2
|
+
|
3
|
+
Changes:
|
4
|
+
|
5
|
+
- xapian query parser flags are now configurable (see README)
|
6
|
+
|
7
|
+
Breaking Changes:
|
8
|
+
|
9
|
+
- enable_phrase_search config option is no longer supported (use config.enable_query_flag Xapian::QueryParser::FLAG_PHRASE instead)
|
10
|
+
|
1
11
|
##1.3.2 (April 10th, 2013)
|
2
12
|
|
3
13
|
Changes:
|
data/README.rdoc
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
= XapianDb
|
2
2
|
|
3
|
-
{<img src="https://secure.travis-ci.org/garaio/xapian_db.png" />}[http://travis-ci.org/garaio/xapian_db]
|
4
|
-
|
5
|
-
== Important Information
|
6
|
-
|
7
|
-
Version 1.3 does not support YAML serialization for attributes anymore. If you don't apply a type information for an attribute (like attribute :birth, as: :date) in your blueprint,
|
8
|
-
the attribute gets stored as a string. The new preferred type for complex attributes is JSON. Why the change? We were experiencing a unacceptable performance hit when we switched from Syck to Psych. The new philosophy for blueprints is therefore explicit type information. lib/type_codec.rb contains the most common codecs and of course, you can add your own (see examples/custom_serialization.rb).
|
9
|
-
|
10
|
-
<b>Please note: You may want to fine tune your blueprints and you MUST rebuild your xapian index when switching to version 1.3</b>
|
11
|
-
|
12
3
|
== What's in the box?
|
13
4
|
|
14
5
|
XapianDb is a ruby gem that combines features of nosql databases and fulltext indexing into one piece. The result: Rich documents and very fast queries. It is based on {Xapian}[http://xapian.org/], an efficient and powerful indexing library.
|
@@ -73,6 +64,7 @@ You can override these defaults by placing a config file named 'xapian_db.yml' i
|
|
73
64
|
adapter: datamapper # Avaliable adapters: :active_record, :datamapper
|
74
65
|
language: de # Global language; can be overridden for specific blueprints
|
75
66
|
term_min_length: 2 # Ignore single character terms
|
67
|
+
enable_query_flags: FLAG_PHRASE, FLAG_SPELLING_CORRECTION
|
76
68
|
|
77
69
|
development:
|
78
70
|
database: db/xapian_db/development
|
@@ -91,8 +83,18 @@ You can override these defaults by placing a config file named 'xapian_db.yml' i
|
|
91
83
|
- adapter: :active_record|:datamapper, default: :active_record
|
92
84
|
- language: any iso language code, default: :none (activates spelling corrections, stemmer and stop words if an iso language code ist set)
|
93
85
|
- term_min_length: <n>, default: 1 (do not index terms shorter than n)
|
94
|
-
- enable_phrase_search: true|false, default: false (see the xapian docs for an intro to phrase searching)
|
95
86
|
- term_splitter_count: <n>, default: 0 (see chapter Term Splitting)
|
87
|
+
- enable_query_flags: <list of flags, separated by colons>
|
88
|
+
- disable_query_flags: <list of flags, separated by colons>
|
89
|
+
|
90
|
+
The following query flags are enabled by default:
|
91
|
+
|
92
|
+
- FLAG_WILDCARD
|
93
|
+
- FLAG_BOOLEAN
|
94
|
+
- FLAG_BOOLEAN_ANY_CASE
|
95
|
+
- FLAG_SPELLING_CORRECTION
|
96
|
+
|
97
|
+
See the xapian docs for all available query flags
|
96
98
|
|
97
99
|
If you do not configure settings for an environment in this file, xapian_db applies the defaults.
|
98
100
|
|
@@ -248,7 +250,7 @@ You can query objects of a specific class:
|
|
248
250
|
|
249
251
|
results = Person.search "name:Foo"
|
250
252
|
|
251
|
-
You can search for exact phrases:
|
253
|
+
You can search for exact phrases (if the query flag is turned on):
|
252
254
|
|
253
255
|
results = XapianDb.search('"this exact sentence"')
|
254
256
|
|
data/lib/xapian_db/config.rb
CHANGED
@@ -53,21 +53,25 @@ module XapianDb
|
|
53
53
|
@config.instance_variable_get("@_term_min_length") || 1
|
54
54
|
end
|
55
55
|
|
56
|
-
def phrase_search_enabled?
|
57
|
-
@config.instance_variable_get("@_phrase_search_enabled") || false
|
58
|
-
end
|
59
|
-
|
60
56
|
def term_splitter_count
|
61
57
|
@config.instance_variable_get("@_term_splitter_count") || 0
|
62
58
|
end
|
59
|
+
|
60
|
+
def query_flags
|
61
|
+
@config.instance_variable_get("@_enabled_query_flags") || [ Xapian::QueryParser::FLAG_WILDCARD,
|
62
|
+
Xapian::QueryParser::FLAG_BOOLEAN,
|
63
|
+
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE,
|
64
|
+
Xapian::QueryParser::FLAG_SPELLING_CORRECTION
|
65
|
+
]
|
66
|
+
end
|
63
67
|
end
|
64
68
|
|
65
69
|
# ---------------------------------------------------------------------------------
|
66
70
|
# DSL methods
|
67
71
|
# ---------------------------------------------------------------------------------
|
68
72
|
|
69
|
-
attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_stemmer, :_stopper,
|
70
|
-
:
|
73
|
+
attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_stemmer, :_stopper,
|
74
|
+
:_term_min_length, :_term_splitter_count, :_enabled_query_flags
|
71
75
|
|
72
76
|
# Set the global database to use
|
73
77
|
# @param [String] path The path to the database. Either apply a file sytem path or :memory
|
@@ -153,19 +157,20 @@ module XapianDb
|
|
153
157
|
@_term_min_length = length
|
154
158
|
end
|
155
159
|
|
156
|
-
|
157
|
-
|
158
|
-
@_phrase_search_enabled = true
|
160
|
+
def term_splitter_count(count)
|
161
|
+
@_term_splitter_count = count
|
159
162
|
end
|
160
163
|
|
161
|
-
|
162
|
-
|
163
|
-
@
|
164
|
+
def enable_query_flag(flag)
|
165
|
+
@_enabled_query_flags ||= []
|
166
|
+
@_enabled_query_flags << flag
|
167
|
+
@_enabled_query_flags.uniq!
|
164
168
|
end
|
165
169
|
|
166
|
-
def
|
167
|
-
@
|
170
|
+
def disable_query_flag(flag)
|
171
|
+
@_enabled_query_flags ||= []
|
172
|
+
@_enabled_query_flags.delete flag
|
168
173
|
end
|
169
|
-
end
|
170
174
|
|
175
|
+
end
|
171
176
|
end
|
@@ -17,11 +17,7 @@ module XapianDb
|
|
17
17
|
|
18
18
|
# Set the parser options
|
19
19
|
@query_flags = 0
|
20
|
-
@query_flags |=
|
21
|
-
@query_flags |= Xapian::QueryParser::FLAG_BOOLEAN # enable boolean operators
|
22
|
-
@query_flags |= Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE # enable case insensitive boolean operators
|
23
|
-
@query_flags |= Xapian::QueryParser::FLAG_SPELLING_CORRECTION # enable spelling corrections
|
24
|
-
@query_flags |= Xapian::QueryParser::FLAG_PHRASE if XapianDb::Config.phrase_search_enabled?
|
20
|
+
XapianDb::Config.query_flags.each { |flag| @query_flags |= flag }
|
25
21
|
end
|
26
22
|
|
27
23
|
# Parse an expression
|
data/lib/xapian_db/railtie.rb
CHANGED
@@ -51,12 +51,9 @@ module XapianDb
|
|
51
51
|
config.resque_queue @resque_queue
|
52
52
|
config.language @language.try(:to_sym)
|
53
53
|
config.term_min_length @term_min_length
|
54
|
-
if @enable_phrase_search
|
55
|
-
config.enable_phrase_search
|
56
|
-
else
|
57
|
-
config.disable_phrase_search
|
58
|
-
end
|
59
54
|
config.term_splitter_count @term_splitter_count
|
55
|
+
@enabled_query_flags.each { |flag| config.enable_query_flag flag }
|
56
|
+
@disabled_query_flags.each { |flag| config.disable_query_flag flag }
|
60
57
|
end
|
61
58
|
|
62
59
|
end
|
@@ -81,6 +78,24 @@ module XapianDb
|
|
81
78
|
@term_min_length = env_config["term_min_length"]
|
82
79
|
@enable_phrase_search = env_config["enable_phrase_search"] == true
|
83
80
|
@term_splitter_count = env_config["term_splitter_count"] || 0
|
81
|
+
|
82
|
+
if env_config["enabled_query_flags"]
|
83
|
+
@enabled_query_flags = []
|
84
|
+
env_config["enabled_query_flags"].split(",").each { |flag_name| @enabled_query_flags << const_get("Xapian::QueryParser::%s" % flag_name.strip) }
|
85
|
+
else
|
86
|
+
@enabled_query_flags = [ Xapian::QueryParser::FLAG_WILDCARD,
|
87
|
+
Xapian::QueryParser::FLAG_BOOLEAN,
|
88
|
+
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE,
|
89
|
+
Xapian::QueryParser::FLAG_SPELLING_CORRECTION
|
90
|
+
]
|
91
|
+
end
|
92
|
+
|
93
|
+
if env_config["disabled_query_flags"]
|
94
|
+
@disabled_query_flags = []
|
95
|
+
env_config["disabled_query_flags"].split(",").each { |flag_name| @disabled_query_flags << const_get("Xapian::QueryParser::%s" % flag_name.strip) }
|
96
|
+
else
|
97
|
+
@disabled_query_flags = []
|
98
|
+
end
|
84
99
|
end
|
85
100
|
|
86
101
|
# set default config options
|
@@ -92,7 +107,11 @@ module XapianDb
|
|
92
107
|
@term_min_length = 1
|
93
108
|
@enable_phrase_search = false
|
94
109
|
@term_splitter_count = 0
|
110
|
+
@enabled_query_flags = [ Xapian::QueryParser::FLAG_WILDCARD,
|
111
|
+
Xapian::QueryParser::FLAG_BOOLEAN,
|
112
|
+
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE,
|
113
|
+
Xapian::QueryParser::FLAG_SPELLING_CORRECTION
|
114
|
+
]
|
95
115
|
end
|
96
|
-
|
97
116
|
end
|
98
117
|
end
|
metadata
CHANGED
@@ -1,174 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xapian_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Gernot Kogler
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-06-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: daemons
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.0.10
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.0.10
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: guard
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 2.3.1
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 2.3.1
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: simplecov
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 0.3.7
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 0.3.7
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: beanstalk-client
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: 1.1.0
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: 1.1.0
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: rake
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: ruby-progressbar
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: resque
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: 1.19.0
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - '>='
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: 1.19.0
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: xapian-ruby
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
|
-
- -
|
129
|
+
- - '>='
|
148
130
|
- !ruby/object:Gem::Version
|
149
131
|
version: 1.2.7.1
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
|
-
- -
|
136
|
+
- - '>='
|
156
137
|
- !ruby/object:Gem::Version
|
157
138
|
version: 1.2.7.1
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: pry-rails
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
|
-
- -
|
143
|
+
- - '>='
|
164
144
|
- !ruby/object:Gem::Version
|
165
145
|
version: '0'
|
166
146
|
type: :development
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
|
-
- -
|
150
|
+
- - '>='
|
172
151
|
- !ruby/object:Gem::Version
|
173
152
|
version: '0'
|
174
153
|
description: XapianDb is a ruby gem that combines features of nosql databases and
|
@@ -228,6 +207,7 @@ files:
|
|
228
207
|
- Rakefile
|
229
208
|
homepage: https://github.com/garaio/xapian_db
|
230
209
|
licenses: []
|
210
|
+
metadata: {}
|
231
211
|
post_install_message:
|
232
212
|
rdoc_options:
|
233
213
|
- --line-numbers
|
@@ -239,25 +219,20 @@ rdoc_options:
|
|
239
219
|
require_paths:
|
240
220
|
- lib
|
241
221
|
required_ruby_version: !ruby/object:Gem::Requirement
|
242
|
-
none: false
|
243
222
|
requirements:
|
244
|
-
- -
|
223
|
+
- - '>='
|
245
224
|
- !ruby/object:Gem::Version
|
246
225
|
version: '0'
|
247
|
-
segments:
|
248
|
-
- 0
|
249
|
-
hash: -1707289322926959795
|
250
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
|
-
none: false
|
252
227
|
requirements:
|
253
|
-
- -
|
228
|
+
- - '>='
|
254
229
|
- !ruby/object:Gem::Version
|
255
230
|
version: 1.3.6
|
256
231
|
requirements: []
|
257
232
|
rubyforge_project:
|
258
|
-
rubygems_version:
|
233
|
+
rubygems_version: 2.0.3
|
259
234
|
signing_key:
|
260
|
-
specification_version:
|
235
|
+
specification_version: 4
|
261
236
|
summary: Ruby library to use a Xapian db as a key/value store with high performance
|
262
237
|
fulltext search
|
263
238
|
test_files: []
|