xapian_db 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/README.rdoc +6 -0
- data/lib/xapian_db/document_blueprint.rb +3 -2
- data/lib/xapian_db/indexer.rb +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/README.rdoc
CHANGED
@@ -173,6 +173,12 @@ If you use associations in your blueprints, it might be a good idea to specify a
|
|
173
173
|
blueprint.base_query { |p| p.includes(:addresses) }
|
174
174
|
end
|
175
175
|
|
176
|
+
If you have configured a term_splitter_count, you might want to exclude certain attributes from the automatic term splitting:
|
177
|
+
|
178
|
+
XapianDb::DocumentBlueprint.setup(:Person) do |blueprint|
|
179
|
+
blueprint.attribute :age, :as => :number, :no_split => true
|
180
|
+
end
|
181
|
+
|
176
182
|
You can specify a natural sort order for each class using a method symbol or a block. If you don't specify an order expression in your xapian query, the matches
|
177
183
|
are ordered by relevance and - within the same relevance - by the natural sort order. If you don't specify the natural sort order, it defaults to id. Examples:
|
178
184
|
|
@@ -362,7 +362,7 @@ module XapianDb
|
|
362
362
|
# Is it a method name with options?
|
363
363
|
if args.last.is_a? Hash
|
364
364
|
options = args.last
|
365
|
-
assert_valid_keys options, :weight, :prefixed
|
365
|
+
assert_valid_keys options, :weight, :prefixed, :no_split
|
366
366
|
@indexed_methods_hash[args.first] = IndexOptions.new(options.merge(:block => block))
|
367
367
|
else
|
368
368
|
add_indexes_from args
|
@@ -403,7 +403,7 @@ module XapianDb
|
|
403
403
|
# Options for an indexed method
|
404
404
|
class IndexOptions
|
405
405
|
|
406
|
-
attr_reader :weight, :prefixed, :block
|
406
|
+
attr_reader :weight, :prefixed, :no_split, :block
|
407
407
|
|
408
408
|
# Constructor
|
409
409
|
# @param [Hash] options
|
@@ -411,6 +411,7 @@ module XapianDb
|
|
411
411
|
def initialize(options = {})
|
412
412
|
@weight = options[:weight] || 1
|
413
413
|
@prefixed = options[:prefixed].nil? ? true : options[:prefixed]
|
414
|
+
@no_split = options[:no_split]
|
414
415
|
@block = options[:block]
|
415
416
|
end
|
416
417
|
|
data/lib/xapian_db/indexer.rb
CHANGED
@@ -86,7 +86,7 @@ module XapianDb
|
|
86
86
|
values = get_values_to_index_from obj
|
87
87
|
values.each do |value|
|
88
88
|
terms = value.to_s.downcase
|
89
|
-
terms = split(terms) if XapianDb::Config.term_splitter_count > 0
|
89
|
+
terms = split(terms) if XapianDb::Config.term_splitter_count > 0 && !options.no_split
|
90
90
|
# Add value with field name
|
91
91
|
term_generator.index_text(terms, options.weight, "X#{method.upcase}") if options.prefixed
|
92
92
|
# Add value without field name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xapian_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: daemons
|
@@ -246,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
246
|
version: '0'
|
247
247
|
segments:
|
248
248
|
- 0
|
249
|
-
hash: -
|
249
|
+
hash: -1707289322926959795
|
250
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
251
|
none: false
|
252
252
|
requirements:
|