xapit 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/Manifest +61 -0
- data/README.rdoc +2 -2
- data/Rakefile +1 -1
- data/lib/xapit/collection.rb +4 -2
- data/lib/xapit/config.rb +9 -0
- data/lib/xapit/facet.rb +13 -8
- data/lib/xapit/query.rb +2 -1
- data/xapit.gemspec +3 -3
- metadata +3 -2
data/CHANGELOG
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
*0.2.2* (June 16th, 2009)
|
2
|
+
|
3
|
+
* performance improvements
|
4
|
+
|
5
|
+
* adding Xapit::Config#close_database method for convenience
|
6
|
+
|
7
|
+
|
1
8
|
*0.2.1* (June 15th, 2009)
|
2
9
|
|
3
10
|
* including Xapit::Membership into ActiveRecord when using gem
|
4
11
|
|
12
|
+
|
5
13
|
*0.2.0* (June 12th, 2009)
|
6
14
|
|
7
15
|
* sort numeric attributes properly
|
data/Manifest
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
CHANGELOG
|
2
|
+
features/facets.feature
|
3
|
+
features/finding.feature
|
4
|
+
features/indexing.feature
|
5
|
+
features/sorting.feature
|
6
|
+
features/step_definitions/common_steps.rb
|
7
|
+
features/step_definitions/xapit_steps.rb
|
8
|
+
features/suggestions.feature
|
9
|
+
features/support/env.rb
|
10
|
+
features/support/xapit_helpers.rb
|
11
|
+
init.rb
|
12
|
+
install.rb
|
13
|
+
lib/xapit/adapters/abstract_adapter.rb
|
14
|
+
lib/xapit/adapters/active_record_adapter.rb
|
15
|
+
lib/xapit/adapters/data_mapper_adapter.rb
|
16
|
+
lib/xapit/collection.rb
|
17
|
+
lib/xapit/config.rb
|
18
|
+
lib/xapit/facet.rb
|
19
|
+
lib/xapit/facet_blueprint.rb
|
20
|
+
lib/xapit/facet_option.rb
|
21
|
+
lib/xapit/index_blueprint.rb
|
22
|
+
lib/xapit/indexers/abstract_indexer.rb
|
23
|
+
lib/xapit/indexers/classic_indexer.rb
|
24
|
+
lib/xapit/indexers/simple_indexer.rb
|
25
|
+
lib/xapit/membership.rb
|
26
|
+
lib/xapit/query.rb
|
27
|
+
lib/xapit/query_parsers/abstract_query_parser.rb
|
28
|
+
lib/xapit/query_parsers/classic_query_parser.rb
|
29
|
+
lib/xapit/query_parsers/simple_query_parser.rb
|
30
|
+
lib/xapit/rake_tasks.rb
|
31
|
+
lib/xapit.rb
|
32
|
+
LICENSE
|
33
|
+
Manifest
|
34
|
+
rails_generators/xapit/templates/setup_xapit.rb
|
35
|
+
rails_generators/xapit/templates/xapit.rake
|
36
|
+
rails_generators/xapit/USAGE
|
37
|
+
rails_generators/xapit/xapit_generator.rb
|
38
|
+
Rakefile
|
39
|
+
README.rdoc
|
40
|
+
spec/spec_helper.rb
|
41
|
+
spec/xapit/adapters/active_record_adapter_spec.rb
|
42
|
+
spec/xapit/adapters/data_mapper_adapter_spec.rb
|
43
|
+
spec/xapit/collection_spec.rb
|
44
|
+
spec/xapit/config_spec.rb
|
45
|
+
spec/xapit/facet_blueprint_spec.rb
|
46
|
+
spec/xapit/facet_option_spec.rb
|
47
|
+
spec/xapit/facet_spec.rb
|
48
|
+
spec/xapit/index_blueprint_spec.rb
|
49
|
+
spec/xapit/indexers/abstract_indexer_spec.rb
|
50
|
+
spec/xapit/indexers/classic_indexer_spec.rb
|
51
|
+
spec/xapit/indexers/simple_indexer_spec.rb
|
52
|
+
spec/xapit/membership_spec.rb
|
53
|
+
spec/xapit/query_parsers/abstract_query_parser_spec.rb
|
54
|
+
spec/xapit/query_parsers/classic_query_parser_spec.rb
|
55
|
+
spec/xapit/query_parsers/simple_query_parser_spec.rb
|
56
|
+
spec/xapit/query_spec.rb
|
57
|
+
spec/xapit_member.rb
|
58
|
+
tasks/spec.rb
|
59
|
+
tasks/xapit.rake
|
60
|
+
TODO
|
61
|
+
uninstall.rb
|
data/README.rdoc
CHANGED
@@ -77,8 +77,8 @@ You may want to trigger this via a cron job on a recurring schedule (i.e. every
|
|
77
77
|
|
78
78
|
There are two projects in development to help improve this reindexing.
|
79
79
|
|
80
|
-
http://github.com/ryanb/xapit-sync/tree/master
|
81
|
-
http://github.com/ryanb/xapit-server/tree/master
|
80
|
+
* http://github.com/ryanb/xapit-sync/tree/master
|
81
|
+
* http://github.com/ryanb/xapit-server/tree/master
|
82
82
|
|
83
83
|
|
84
84
|
== Search
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('xapit', '0.2.
|
5
|
+
Echoe.new('xapit', '0.2.2') do |p|
|
6
6
|
p.summary = "Ruby library for interacting with Xapian, a full text search engine."
|
7
7
|
p.description = "Ruby library for interacting with Xapian, a full text search engine."
|
8
8
|
p.url = "http://github.com/ryanb/xapit"
|
data/lib/xapit/collection.rb
CHANGED
@@ -141,14 +141,16 @@ module Xapit
|
|
141
141
|
@query_parser.spelling_suggestion
|
142
142
|
end
|
143
143
|
|
144
|
-
|
145
|
-
|
144
|
+
# All Xapit::Facet objects, even if they do not include options.
|
145
|
+
# Usually you'll want to call Collection#facets
|
146
146
|
def all_facets
|
147
147
|
@query_parser.member_class.xapit_index_blueprint.facets.map do |facet_blueprint|
|
148
148
|
Facet.new(facet_blueprint, @query_parser.query, @query_parser.facet_identifiers)
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
+
private
|
153
|
+
|
152
154
|
def matchset(options = {})
|
153
155
|
@query_parser.query.matchset(options)
|
154
156
|
end
|
data/lib/xapit/config.rb
CHANGED
@@ -70,6 +70,15 @@ module Xapit
|
|
70
70
|
@database = nil
|
71
71
|
@writable_database = nil
|
72
72
|
end
|
73
|
+
|
74
|
+
# Clear the current database from memory. Unfortunately this is a hack because
|
75
|
+
# Xapian doesn't provide a "close" method on the database. We just have to hope
|
76
|
+
# no other references are lying around.
|
77
|
+
def close_database
|
78
|
+
@database = nil
|
79
|
+
@writable_database = nil
|
80
|
+
GC.start
|
81
|
+
end
|
73
82
|
end
|
74
83
|
end
|
75
84
|
end
|
data/lib/xapit/facet.rb
CHANGED
@@ -20,16 +20,21 @@ module Xapit
|
|
20
20
|
@existing_facet_identifiers = existing_facet_identifiers
|
21
21
|
end
|
22
22
|
|
23
|
-
# Xapit::FacetOption objects for this facet
|
23
|
+
# Xapit::FacetOption objects for this facet which match the current query.
|
24
|
+
# Hides options which don't narrow down results.
|
24
25
|
def options
|
26
|
+
unfiltered_options.select { |o| o.count < @query.count }
|
27
|
+
end
|
28
|
+
|
29
|
+
# Xapit::FacetOption objects for this facet which match the current query.
|
30
|
+
# Includes options which may not narrow down result set.
|
31
|
+
def unfiltered_options
|
25
32
|
matching_identifiers.map do |identifier, count|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
option
|
32
|
-
end
|
33
|
+
option = FacetOption.find(identifier)
|
34
|
+
if option.facet.attribute == @blueprint.attribute
|
35
|
+
option.count = count
|
36
|
+
option.existing_facet_identifiers = @existing_facet_identifiers
|
37
|
+
option
|
33
38
|
end
|
34
39
|
end.compact.sort_by(&:name)
|
35
40
|
end
|
data/lib/xapit/query.rb
CHANGED
@@ -43,12 +43,13 @@ module Xapit
|
|
43
43
|
|
44
44
|
def count
|
45
45
|
# a bit of a hack to get more accurate count estimate
|
46
|
-
matchset(:limit => Config.database.doccount).matches_estimated
|
46
|
+
@count ||= matchset(:limit => Config.database.doccount).matches_estimated
|
47
47
|
end
|
48
48
|
|
49
49
|
private
|
50
50
|
|
51
51
|
def merge_query(operator, *args)
|
52
|
+
@count = nil
|
52
53
|
@xapian_query = Xapian::Query.new(xapian_operator(operator), @xapian_query, build_xapian_query(*args)) unless args.first.blank?
|
53
54
|
self
|
54
55
|
end
|
data/xapit.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{xapit}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ryan Bates"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-16}
|
10
10
|
s.description = %q{Ruby library for interacting with Xapian, a full text search engine.}
|
11
11
|
s.email = %q{ryan (at) railscasts (dot) com}
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "lib/xapit/adapters/abstract_adapter.rb", "lib/xapit/adapters/active_record_adapter.rb", "lib/xapit/adapters/data_mapper_adapter.rb", "lib/xapit/collection.rb", "lib/xapit/config.rb", "lib/xapit/facet.rb", "lib/xapit/facet_blueprint.rb", "lib/xapit/facet_option.rb", "lib/xapit/index_blueprint.rb", "lib/xapit/indexers/abstract_indexer.rb", "lib/xapit/indexers/classic_indexer.rb", "lib/xapit/indexers/simple_indexer.rb", "lib/xapit/membership.rb", "lib/xapit/query.rb", "lib/xapit/query_parsers/abstract_query_parser.rb", "lib/xapit/query_parsers/classic_query_parser.rb", "lib/xapit/query_parsers/simple_query_parser.rb", "lib/xapit/rake_tasks.rb", "lib/xapit.rb", "LICENSE", "README.rdoc", "tasks/spec.rb", "tasks/xapit.rake", "TODO"]
|
13
|
-
s.files = ["CHANGELOG", "features/facets.feature", "features/finding.feature", "features/indexing.feature", "features/sorting.feature", "features/step_definitions/common_steps.rb", "features/step_definitions/xapit_steps.rb", "features/suggestions.feature", "features/support/env.rb", "features/support/xapit_helpers.rb", "init.rb", "install.rb", "lib/xapit/adapters/abstract_adapter.rb", "lib/xapit/adapters/active_record_adapter.rb", "lib/xapit/adapters/data_mapper_adapter.rb", "lib/xapit/collection.rb", "lib/xapit/config.rb", "lib/xapit/facet.rb", "lib/xapit/facet_blueprint.rb", "lib/xapit/facet_option.rb", "lib/xapit/index_blueprint.rb", "lib/xapit/indexers/abstract_indexer.rb", "lib/xapit/indexers/classic_indexer.rb", "lib/xapit/indexers/simple_indexer.rb", "lib/xapit/membership.rb", "lib/xapit/query.rb", "lib/xapit/query_parsers/abstract_query_parser.rb", "lib/xapit/query_parsers/classic_query_parser.rb", "lib/xapit/query_parsers/simple_query_parser.rb", "lib/xapit/rake_tasks.rb", "lib/xapit.rb", "LICENSE", "rails_generators/xapit/templates/setup_xapit.rb", "rails_generators/xapit/templates/xapit.rake", "rails_generators/xapit/USAGE", "rails_generators/xapit/xapit_generator.rb", "Rakefile", "README.rdoc", "spec/spec_helper.rb", "spec/xapit/adapters/active_record_adapter_spec.rb", "spec/xapit/adapters/data_mapper_adapter_spec.rb", "spec/xapit/collection_spec.rb", "spec/xapit/config_spec.rb", "spec/xapit/facet_blueprint_spec.rb", "spec/xapit/facet_option_spec.rb", "spec/xapit/facet_spec.rb", "spec/xapit/index_blueprint_spec.rb", "spec/xapit/indexers/abstract_indexer_spec.rb", "spec/xapit/indexers/classic_indexer_spec.rb", "spec/xapit/indexers/simple_indexer_spec.rb", "spec/xapit/membership_spec.rb", "spec/xapit/query_parsers/abstract_query_parser_spec.rb", "spec/xapit/query_parsers/classic_query_parser_spec.rb", "spec/xapit/query_parsers/simple_query_parser_spec.rb", "spec/xapit/query_spec.rb", "spec/xapit_member.rb", "tasks/spec.rb", "tasks/xapit.rake", "TODO", "uninstall.rb", "xapit.gemspec"]
|
13
|
+
s.files = ["CHANGELOG", "features/facets.feature", "features/finding.feature", "features/indexing.feature", "features/sorting.feature", "features/step_definitions/common_steps.rb", "features/step_definitions/xapit_steps.rb", "features/suggestions.feature", "features/support/env.rb", "features/support/xapit_helpers.rb", "init.rb", "install.rb", "lib/xapit/adapters/abstract_adapter.rb", "lib/xapit/adapters/active_record_adapter.rb", "lib/xapit/adapters/data_mapper_adapter.rb", "lib/xapit/collection.rb", "lib/xapit/config.rb", "lib/xapit/facet.rb", "lib/xapit/facet_blueprint.rb", "lib/xapit/facet_option.rb", "lib/xapit/index_blueprint.rb", "lib/xapit/indexers/abstract_indexer.rb", "lib/xapit/indexers/classic_indexer.rb", "lib/xapit/indexers/simple_indexer.rb", "lib/xapit/membership.rb", "lib/xapit/query.rb", "lib/xapit/query_parsers/abstract_query_parser.rb", "lib/xapit/query_parsers/classic_query_parser.rb", "lib/xapit/query_parsers/simple_query_parser.rb", "lib/xapit/rake_tasks.rb", "lib/xapit.rb", "LICENSE", "Manifest", "rails_generators/xapit/templates/setup_xapit.rb", "rails_generators/xapit/templates/xapit.rake", "rails_generators/xapit/USAGE", "rails_generators/xapit/xapit_generator.rb", "Rakefile", "README.rdoc", "spec/spec_helper.rb", "spec/xapit/adapters/active_record_adapter_spec.rb", "spec/xapit/adapters/data_mapper_adapter_spec.rb", "spec/xapit/collection_spec.rb", "spec/xapit/config_spec.rb", "spec/xapit/facet_blueprint_spec.rb", "spec/xapit/facet_option_spec.rb", "spec/xapit/facet_spec.rb", "spec/xapit/index_blueprint_spec.rb", "spec/xapit/indexers/abstract_indexer_spec.rb", "spec/xapit/indexers/classic_indexer_spec.rb", "spec/xapit/indexers/simple_indexer_spec.rb", "spec/xapit/membership_spec.rb", "spec/xapit/query_parsers/abstract_query_parser_spec.rb", "spec/xapit/query_parsers/classic_query_parser_spec.rb", "spec/xapit/query_parsers/simple_query_parser_spec.rb", "spec/xapit/query_spec.rb", "spec/xapit_member.rb", "tasks/spec.rb", "tasks/xapit.rake", "TODO", "uninstall.rb", "xapit.gemspec"]
|
14
14
|
s.homepage = %q{http://github.com/ryanb/xapit}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Xapit", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xapit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/xapit/rake_tasks.rb
|
79
79
|
- lib/xapit.rb
|
80
80
|
- LICENSE
|
81
|
+
- Manifest
|
81
82
|
- rails_generators/xapit/templates/setup_xapit.rb
|
82
83
|
- rails_generators/xapit/templates/xapit.rake
|
83
84
|
- rails_generators/xapit/USAGE
|