gsa 0.6.1 → 0.7.0
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/README.md +9 -29
- data/fixtures/cassette_library/many_results_no_filters.yml +346 -1
- data/fixtures/cassette_library/many_results_with_filters.yml +262 -1
- data/fixtures/cassette_library/no_result_no_filters.yml +54 -1
- data/fixtures/cassette_library/no_result_with_filters.yml +55 -1
- data/fixtures/cassette_library/single_result_no_filters.yml +130 -1
- data/fixtures/cassette_library/single_result_with_filters.yml +125 -1
- data/fixtures/queries/many.txt +1 -1
- data/fixtures/queries/single.txt +1 -1
- data/fixtures/result_sets/many.txt +1 -1
- data/fixtures/result_sets/single.txt +1 -1
- data/fixtures/uids/many.txt +1 -1
- data/fixtures/uids/single.txt +1 -1
- data/lib/defaults.rb +14 -0
- data/lib/facade.rb +0 -8
- data/lib/gsa.rb +5 -1
- data/lib/gsa/readable_results.rb +14 -0
- data/lib/gsa/readable_results/readable_buckets.rb +19 -0
- data/lib/gsa/readable_results/readable_facets.rb +22 -0
- data/lib/gsa/readable_results/readable_metatags.rb +15 -0
- data/lib/gsa/readable_results/readable_result_sets.rb +22 -0
- data/lib/gsa/search_converter.rb +9 -32
- data/lib/gsa/searcher.rb +2 -1
- data/lib/gsa/version.rb +1 -1
- data/spec/lib/gsa_spec.rb +32 -42
- metadata +7 -7
- data/fixtures/facets/many.txt +0 -1
- data/fixtures/facets/single.txt +0 -1
- data/fixtures/result_sets/many_facets.txt +0 -1
- data/fixtures/result_sets/single_facets.txt +0 -1
- data/lib/gsa/faceter.rb +0 -41
data/fixtures/facets/many.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
[:voltage, :brand, :material, :bulb_type, :bulb_color]
|
data/fixtures/facets/single.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
[:voltage]
|
@@ -1 +0,0 @@
|
|
1
|
-
{:voltage=>[["220", 2], ["120", 3], ["65", 2], ["135", 2], ["45", 5], ["140", 1], ["115", 1], ["110", 1], ["75", 1], ["100", 1]], :brand=>[["Plusrite", 4], ["Tcp", 3], ["Bulbrite", 3], ["Sylvania", 1], ["Eiko", 3], ["Philips", 4], ["Satco", 1]], :material=>[["Fabric", 4], ["Plastic", 1], ["Fiberglass", 1], ["Glass", 5], ["Resin", 1], ["Metal", 2], ["Brass", 1], ["Ceramic", 1], ["Wood", 3]], :bulb_type=>[["Flourescent", 4], ["Halogen", 2], ["Incandescent", 10], ["Led", 3]], :bulb_color=>[["Blue", 19]]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{:voltage=>[["220", 2], ["120", 3], ["65", 2], ["135", 2], ["45", 5], ["140", 1], ["115", 1], ["110", 1], ["75", 1], ["100", 1]]}
|
data/lib/gsa/faceter.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
module GSA
|
2
|
-
class Faceter
|
3
|
-
def self.facet(search_results, facetables=[])
|
4
|
-
faceted = build_faceted(facetables)
|
5
|
-
|
6
|
-
faceted = populate_faceted(search_results, facetables, faceted)
|
7
|
-
|
8
|
-
faceted = group_faceted(facetables, faceted)
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.build_faceted(facetables)
|
12
|
-
faceted = {}
|
13
|
-
facetables.each {|facetable| faceted[facetable] = []}
|
14
|
-
faceted
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.populate_faceted(search_results, facetables, faceted)
|
18
|
-
search_results.each {|result| handle_metatags(result, facetables, faceted)}
|
19
|
-
faceted
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.handle_metatags(result, facetables, faceted)
|
23
|
-
result[:metatags].each {|metatag| add_value_to_group(facetables, faceted, metatag)}
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.add_value_to_group(facetables, faceted, metatag)
|
27
|
-
if facetables.include? metatag[:meta_name].to_sym
|
28
|
-
faceted[metatag[:meta_name].to_sym] << metatag[:meta_value]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.group_faceted(facetables, faceted)
|
33
|
-
facetables.each {|facetable| faceted[facetable] = sub_groups(faceted, facetable)}
|
34
|
-
faceted
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.sub_groups(faceted, facetable)
|
38
|
-
faceted[facetable].group_by(&:capitalize).map {|k,v| [k, v.length]} # change capitalize to something less invasive (don't alter the original form)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|