xapian-fu 1.2 → 1.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.
- data/CHANGELOG.rdoc +4 -0
- data/README.rdoc +2 -2
- data/lib/xapian_fu/query_parser.rb +2 -1
- data/spec/xapian_db_spec.rb +16 -0
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -139,7 +139,7 @@ Wildcards
|
|
139
139
|
|
140
140
|
Phrase searches
|
141
141
|
|
142
|
-
db.search("'
|
142
|
+
db.search("'a steamer in the gene pool'", :phrase => true)
|
143
143
|
|
144
144
|
And any combinations of the above:
|
145
145
|
|
@@ -184,7 +184,7 @@ perhaps by reindexing once in a while.
|
|
184
184
|
= More Info
|
185
185
|
|
186
186
|
Author:: John Leach (mailto:john@johnleach.co.uk)
|
187
|
-
Copyright:: Copyright (c) 2009-
|
187
|
+
Copyright:: Copyright (c) 2009-2011 John Leach
|
188
188
|
License:: MIT (The Xapian library is GPL)
|
189
189
|
Mailing list:: http://rubyforge.org/mailman/listinfo/xapian-fu-discuss
|
190
190
|
Web page:: http://johnleach.co.uk/documents/xapian-fu
|
@@ -120,7 +120,7 @@ module XapianFu #:nodoc:
|
|
120
120
|
if @flags
|
121
121
|
@flags
|
122
122
|
else
|
123
|
-
valid_flags = [:boolean, :boolean_anycase, :wildcards, :lovehate, :spelling, :pure_not, :synonyms]
|
123
|
+
valid_flags = [:boolean, :boolean_anycase, :wildcards, :lovehate, :spelling, :pure_not, :synonyms, :phrase]
|
124
124
|
@flags = valid_flags.delete_if { |vf| not @options[vf] }
|
125
125
|
end
|
126
126
|
end
|
@@ -136,6 +136,7 @@ module XapianFu #:nodoc:
|
|
136
136
|
qflags |= Xapian::QueryParser::FLAG_SPELLING_CORRECTION if flags.include?(:spelling)
|
137
137
|
qflags |= Xapian::QueryParser::FLAG_PURE_NOT if flags.include?(:pure_not)
|
138
138
|
qflags |= Xapian::QueryParser::FLAG_AUTO_SYNONYMS if flags.include?(:synonyms)
|
139
|
+
qflags |= Xapian::QueryParser::FLAG_PHRASE if flags.include?(:phrase)
|
139
140
|
qflags
|
140
141
|
end
|
141
142
|
|
data/spec/xapian_db_spec.rb
CHANGED
@@ -292,6 +292,22 @@ describe XapianDb do
|
|
292
292
|
results.corrected_query.should == ""
|
293
293
|
end
|
294
294
|
|
295
|
+
it "should do phrase matching when the :phrase option is set" do
|
296
|
+
xdb = XapianDb.new
|
297
|
+
doc1 = xdb << "the dog growls at the guitar"
|
298
|
+
doc2 = xdb << "the cat growls at the dog"
|
299
|
+
xdb.search('"the dog growls"').should == [doc1, doc2]
|
300
|
+
xdb.search('"the dog growls"', :phrase => true).should == [doc1]
|
301
|
+
end
|
302
|
+
|
303
|
+
it "should do phrase matching on fields" do
|
304
|
+
xdb = XapianDb.new(:fields => [:title])
|
305
|
+
doc1 = xdb << { :title => "the dog growls", :body => "at the guitar" }
|
306
|
+
doc2 = xdb << { :title => "the cat growls", :body => "at the dog" }
|
307
|
+
xdb.search('title:"the dog growls"', :phrase => true).should == [doc1]
|
308
|
+
xdb.search('title:"at the guitar"', :phrase => true).should == []
|
309
|
+
end
|
310
|
+
|
295
311
|
|
296
312
|
it "should do phrase matching by default when then :default_op option is :phrase" do
|
297
313
|
pending
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xapian-fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: "1.
|
8
|
+
- 3
|
9
|
+
version: "1.3"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Leach
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-07-
|
17
|
+
date: 2011-07-07 00:00:00 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rspec
|