sunspot_stats 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -6
- data/lib/search/stat_facet.rb +3 -3
- data/lib/sunspot_stats/version.rb +1 -1
- data/spec/api/query/stats_spec.rb +2 -0
- data/sunspot_stats.gemspec +1 -3
- metadata +3 -21
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Sunspot Stats
|
2
2
|
|
3
|
-
Sunspot is a Ruby library for expressive, powerful interaction with the Solr search engine. I use the latest version [2.
|
3
|
+
Sunspot is a Ruby library for expressive, powerful interaction with the Solr search engine. I use the latest version [2.1.0](http://rubygems.org/gems/sunspot/versions/2.1.0) but i need the statsComponent in order to get the sum (min, max, count, sumOfSquares, mean, stddev) on a given indexed field.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -44,16 +44,16 @@ If you enable faceting on stats the stat_field is the facet and the value is the
|
|
44
44
|
|
45
45
|
[Upgrade solr in sunspot](https://github.com/sunspot/sunspot/wiki/Upgrading-sunspot_solr-Solr-Instance)
|
46
46
|
|
47
|
-
### Boolean Searches
|
48
47
|
|
49
|
-
|
48
|
+
### StatsComponent Notes
|
50
49
|
|
51
|
-
a
|
50
|
+
The facet field can be selectively applied. That is if you want stats on field "A" and "B", you can facet a on "X" and B on "Y" using &stats.field=A&f.A.stats.facet=X&stats.field=B&f.B.stats.facet=Y
|
52
51
|
|
53
|
-
|
52
|
+
*Warning*, as implemented, all facet results are returned, be careful what fields you ask for!
|
54
53
|
|
55
|
-
|
54
|
+
Multi-valued fields and facets may be slow.
|
56
55
|
|
56
|
+
[StatsComponent](http://wiki.apache.org/solr/StatsComponent)
|
57
57
|
|
58
58
|
## Contributing
|
59
59
|
|
data/lib/search/stat_facet.rb
CHANGED
@@ -18,7 +18,7 @@ module Sunspot
|
|
18
18
|
@sort = false
|
19
19
|
@rows ||=
|
20
20
|
begin
|
21
|
-
if
|
21
|
+
if @search.stat_response.present? && @search.stat_response['stats_fields'].present?
|
22
22
|
if @options[:facet].present?
|
23
23
|
stat = @search.stat_response['stats_fields'][@field.indexed_name]
|
24
24
|
data = stat.nil? ? [] : stat['facets'][@options[:facet].indexed_name]
|
@@ -31,7 +31,7 @@ module Sunspot
|
|
31
31
|
rows = []
|
32
32
|
|
33
33
|
data.collect do |stat, value|
|
34
|
-
rows << StatRow.new(stat, value[@options[:type]], value, self)
|
34
|
+
rows << StatRow.new(stat, value[@options[:type]], value, self) if value.present?
|
35
35
|
end
|
36
36
|
|
37
37
|
if @options[:sort] == :count
|
@@ -41,7 +41,7 @@ module Sunspot
|
|
41
41
|
end if @sort
|
42
42
|
return rows.empty? ? [] : rows[0..@options[:limit]]
|
43
43
|
rescue Exception => e
|
44
|
-
puts "
|
44
|
+
puts "Sunspot Stats error: #{e.message} \n\n #{e.backtrace}"
|
45
45
|
return []
|
46
46
|
end
|
47
47
|
end
|
data/sunspot_stats.gemspec
CHANGED
@@ -6,8 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["giovannelli@extendi.it"]
|
7
7
|
gem.description = <<-TEXT
|
8
8
|
Sunspot is a library providing a powerful, all-ruby API for the Solr search engine. This gem extend sunspot adding the
|
9
|
-
statsComponent feature, which returns simple statistics for indexed numeric fields within the DocSet.
|
10
|
-
for searches, here we extend to edismax to manage also boolean logic searches.
|
9
|
+
statsComponent feature, which returns simple statistics for indexed numeric fields within the DocSet.
|
11
10
|
TEXT
|
12
11
|
gem.summary = "Added the statsComponent to sunspot"
|
13
12
|
gem.homepage = "https://github.com/giovannelli/sunspot_stats"
|
@@ -18,7 +17,6 @@ Gem::Specification.new do |gem|
|
|
18
17
|
gem.require_paths = ["lib"]
|
19
18
|
gem.version = SunspotStats::VERSION
|
20
19
|
|
21
|
-
gem.add_dependency "sunspot", "~> 2.0.0"
|
22
20
|
gem.add_development_dependency "rspec"
|
23
21
|
|
24
22
|
gem.rdoc_options << '--webcvs=http://github.com/giovannelli/sunspot_stats/tree/master/%s' <<
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunspot_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: sunspot
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.0
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.0
|
30
14
|
- !ruby/object:Gem::Dependency
|
31
15
|
name: rspec
|
32
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,9 +29,7 @@ dependencies:
|
|
45
29
|
version: '0'
|
46
30
|
description: ! " Sunspot is a library providing a powerful, all-ruby API for
|
47
31
|
the Solr search engine. This gem extend sunspot adding the \n statsComponent
|
48
|
-
feature, which returns simple statistics for indexed numeric fields within the DocSet
|
49
|
-
Usually Suspot use the dismax\n for searches, here we extend to edismax to
|
50
|
-
manage also boolean logic searches.\n"
|
32
|
+
feature, which returns simple statistics for indexed numeric fields within the DocSet.\n"
|
51
33
|
email:
|
52
34
|
- giovannelli@extendi.it
|
53
35
|
executables: []
|