xapian_db 1.3.7 → 1.3.7.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.rdoc +3 -3
- data/lib/xapian_db/document_blueprint.rb +2 -0
- data/lib/xapian_db/query_parser.rb +13 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5b58a771fe0958c2b5058fed842f532d02d83d2
|
4
|
+
data.tar.gz: cf1801e0f6d3386031084d274073bc75572af6a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c73a5ccda203e1242cea1aedb58e1e738f4fc599c89e2a2b7f37e77acb938392726164a5c6f4580595452a3fafa37faa466c07ba46d4f80461142f39fcb2656
|
7
|
+
data.tar.gz: 22483ae031a7f96cc7ea13cf67b109699db418fef80d980b662b9339109384fe67961f2f82201d5d1de25cee34b292c3c11a32bb3f5f160cb9f096c85514e8d6
|
data/CHANGELOG.md
CHANGED
data/README.rdoc
CHANGED
@@ -47,7 +47,7 @@ Make sure version 1.2.6 or newer is installed.
|
|
47
47
|
If you want to use xapian_db in a Rails app, you need Rails 3 or newer.
|
48
48
|
|
49
49
|
For a first look, look at the examples in the examples folder. There's the simple ruby script basic.rb that shows the basic
|
50
|
-
usage of XapianDB without rails. In the basic_rails folder you'll find a very simple Rails app
|
50
|
+
usage of XapianDB without rails. In the basic_rails folder you'll find a very simple Rails app using XapianDb.
|
51
51
|
|
52
52
|
The following steps assume that you are using xapian_db within a Rails app.
|
53
53
|
|
@@ -64,7 +64,7 @@ You can override these defaults by placing a config file named 'xapian_db.yml' i
|
|
64
64
|
adapter: datamapper # Avaliable adapters: :active_record, :datamapper
|
65
65
|
language: de # Global language; can be overridden for specific blueprints
|
66
66
|
term_min_length: 2 # Ignore single character terms
|
67
|
-
|
67
|
+
enabled_query_flags: FLAG_PHRASE, FLAG_SPELLING_CORRECTION
|
68
68
|
|
69
69
|
development:
|
70
70
|
database: db/xapian_db/development
|
@@ -205,7 +205,7 @@ by their accentless form:
|
|
205
205
|
end
|
206
206
|
|
207
207
|
XapianDb::Config.setup do |config|
|
208
|
-
config.indexer_preprocess_callback
|
208
|
+
config.indexer_preprocess_callback Util.method(:strip_accents)
|
209
209
|
end
|
210
210
|
|
211
211
|
You may use attributes from associated objects in a blueprint; if you do that and an associated object is updated, your objects should be reindexed, too. You can tell XapnaDB about those dependencies like so:
|
@@ -26,6 +26,8 @@ module XapianDb
|
|
26
26
|
# ---------------------------------------------------------------------------------
|
27
27
|
class << self
|
28
28
|
|
29
|
+
attr_reader :blueprints
|
30
|
+
|
29
31
|
# Configure the blueprint for a class.
|
30
32
|
# Available options:
|
31
33
|
# - adapter (see {#adapter} for details)
|
@@ -35,6 +35,10 @@ module XapianDb
|
|
35
35
|
|
36
36
|
# Add the searchable prefixes to allow searches by field
|
37
37
|
# (like "name:Kogler")
|
38
|
+
processors = [] # The reason for having a seemingly useless "processors" array is as follows:
|
39
|
+
# We need to add a reference to the generated Xapian::XYValueRangeProcessor objects to the scope that calls parser.parse_query.
|
40
|
+
# If we don't, the Ruby GC will often garbage collect the generated objects before parser.parse_query can be called,
|
41
|
+
# which would free the memory of the corresponding C++ objects and result in segmentation faults upon calling parse_query.
|
38
42
|
XapianDb::DocumentBlueprint.searchable_prefixes.each do |prefix|
|
39
43
|
parser.add_prefix(prefix.to_s.downcase, "X#{prefix.to_s.upcase}")
|
40
44
|
type_info = XapianDb::DocumentBlueprint.type_info_for(prefix)
|
@@ -42,11 +46,17 @@ module XapianDb
|
|
42
46
|
value_number = XapianDb::DocumentBlueprint.value_number_for(prefix)
|
43
47
|
case type_info
|
44
48
|
when :date
|
45
|
-
|
49
|
+
processor = Xapian::DateValueRangeProcessor.new(value_number, "#{prefix}:")
|
50
|
+
processors << processor
|
51
|
+
parser.add_valuerangeprocessor(processor)
|
46
52
|
when :number
|
47
|
-
|
53
|
+
processor = Xapian::NumberValueRangeProcessor.new(value_number, "#{prefix}:")
|
54
|
+
processors << processor
|
55
|
+
parser.add_valuerangeprocessor(processor)
|
48
56
|
when :string
|
49
|
-
|
57
|
+
processor = Xapian::StringValueRangeProcessor.new(value_number, "#{prefix}:")
|
58
|
+
processors << processor
|
59
|
+
parser.add_valuerangeprocessor(processor)
|
50
60
|
end
|
51
61
|
end
|
52
62
|
query = parser.parse_query(expression, @query_flags)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xapian_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.7
|
4
|
+
version: 1.3.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gernot Kogler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
261
|
version: 1.3.6
|
262
262
|
requirements: []
|
263
263
|
rubyforge_project:
|
264
|
-
rubygems_version: 2.
|
264
|
+
rubygems_version: 2.4.8
|
265
265
|
signing_key:
|
266
266
|
specification_version: 4
|
267
267
|
summary: Ruby library to use a Xapian db as a key/value store with high performance
|