gsa 0.5.2 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb7ab83987937bd6e2115d300a904349e76956b6
4
- data.tar.gz: c8882dfaeda6c36d68204da988309cb21141ecfc
3
+ metadata.gz: b93fcf3b6efc2351766b21247a1ccfd3c277a7b7
4
+ data.tar.gz: e9f71ac590fd54b84c319125c1c2d1d848588a20
5
5
  SHA512:
6
- metadata.gz: ae62141d18608f60d837ad1036d731988361b238c7d7f75a2b58280f12f6ffc8f2254771d96242d6ca64d4ff349418a153d3457d1e8e7d831bd67c233a70af74
7
- data.tar.gz: b6c5745215040a1760f81a9aa5ec218dddb49c31f7f3fe609b33ebe9ae95fd39fc0bc2a608158bb1fc51b19117067fbd002a65895dccf3d9b060145fd4b3afb3
6
+ metadata.gz: d51c1c8d3aa4146748d6e3e5af4c98efb6721c65daab0e9d745d0bc9209a38aee44e774186e0a09a28ba9b477522a4ccb342aa48944a791c531f3decd264f75d
7
+ data.tar.gz: 4f68b3c840cfe33bb90ad2d1b6f15e99386c4b91d0d62b64161afe880a18f69a6301503ee58e284e7f452b98bbc34c3e43a59638b8fca9dd65c6384c0708da18
data/README.md CHANGED
@@ -1,3 +1,182 @@
1
- ## GSA Ruby Gem
2
- * Work in progress.
3
- * Documentation coming tomorrow (09/20/2013)
1
+ # The GSA Ruby Gem
2
+
3
+ Quickly and easily harness GSA indexing power with one-line feeding, searching, and faceting.
4
+
5
+ ## Installation
6
+ ```
7
+ gem install gsa
8
+ ```
9
+
10
+ ## Getting Started
11
+ Set the base uri to your GSA box
12
+ ```ruby
13
+ GSA.base_uri = 'http://path-to-gsa-box.com/'
14
+ ```
15
+
16
+ ## Feeding
17
+
18
+ 1.) Structure the records you wish to feed to the GSA as an array of hashes
19
+ ```ruby
20
+ @products = [
21
+ { :id => "1", :name => "Foo", :price => 12, :brand => 'BazBrand' },
22
+ { :id => "2", :name => "Bar", :price => 15, :brand => 'BazBrand' }
23
+ ]
24
+ ```
25
+
26
+ 2.) Feed the records to the GSA
27
+ ```ruby
28
+ GSA.feed(
29
+ :records => @products,
30
+ :searchable => [:name, :price],
31
+ :datasource_name => "Baz",
32
+ :datasource_uri => "http://your-app-base-url/products",
33
+ :datasource_uid => "id",
34
+ :delete? => false
35
+ )
36
+ ```
37
+
38
+ ### Feed Parameters
39
+
40
+ **Required**
41
+
42
+ :records
43
+ >The records source being pushed to the GSA index
44
+
45
+ :searchable
46
+ >Attributes on the record you want searched when a query is made
47
+
48
+ :datasource_name
49
+ >Name of the datasource on the GSA
50
+
51
+ :datasource_uri
52
+ >The URI for your records source
53
+
54
+ :datasource_uid
55
+ >The unique id of the record source
56
+
57
+ **Optional**
58
+
59
+ :delete?
60
+ >Determines whether the feed is an "add" or a "delete" feed; defaults to "false"
61
+
62
+ ### Expected Feed result value
63
+
64
+ If the feed is successful, the feed method will return "Success".
65
+
66
+ ## Searching
67
+
68
+ To search, simply pass in a query:
69
+
70
+ ```ruby
71
+ query = "Foo"
72
+ GSA.search( query )
73
+ ```
74
+ To extract the UIDs from the search results, use the uids method on the search results:
75
+
76
+ ```ruby
77
+ GSA.uids( search_results )
78
+ ```
79
+
80
+ To filter results using GSA filters, pass in an optional 'filters' key-value pair:
81
+
82
+ ```ruby
83
+ # gets all search results for 'Foo' where the price is '12'
84
+ query = "Foo"
85
+ filters = "price:12"
86
+ GSA.search( query, :filters => filters)
87
+ ```
88
+
89
+ Multiple filters can be passed in using a '.' in-between filters:
90
+
91
+ ```ruby
92
+ filters = "price:12.name:Foo"
93
+ ```
94
+
95
+ Multiple key-value pairs can be passed in as optional parameters to override defaults:
96
+
97
+ ```ruby
98
+ GSA.search( query, :filters => filters, :num => 100, :sort => 'relevance', :output => 'xml')
99
+ ```
100
+
101
+ ### Search Parameters
102
+
103
+ **Required**
104
+
105
+ query
106
+ >The query for the search
107
+
108
+ Optional Parameters:
109
+
110
+ :filter
111
+ >* Maps to the GSA 'filter' parameter
112
+ >* Accepted values: 0, 1, s, p
113
+ >* Default value: 0
114
+
115
+ :getfields
116
+ >* Maps to the GSA 'getfields' parameter
117
+ >* Pass in the names of specific attributes you want returned with the results
118
+ >* Single attribute example: "name"
119
+ >* Multiple attribute example: "name.price"
120
+ >* Value to return all attributes: "*"
121
+ >* Default value: "*"
122
+
123
+ :sort
124
+ >* Maps to the GSA 'sort' parameter.
125
+ >* Accepted values: 'relevance', 'date'
126
+ >* Default value: 'relevance'
127
+
128
+ :num
129
+ >* Maps to the GSA 'num' parameter.
130
+ >* Use this parameter to limit the number of search results returned
131
+ >* Accepted values: 1..1000
132
+ >* Default value: 1000
133
+
134
+ :output
135
+ >* Maps to the GSA 'output' parameter.
136
+ >* It is not recommended that you change this value from the default
137
+ >* Accepted values: 'xml', 'no_dtd_xml'
138
+ >* Default value: 'no_dtd_xml'
139
+
140
+ :filters
141
+ >* Maps the the GSA 'requiredfields' parameter
142
+ >* Filters search results to conform to specific required attributes
143
+ >* Example: 'name:Foo'
144
+ >* Example: 'name:Foo.price:12'
145
+
146
+ ## Faceting
147
+
148
+ To leverage faceting, simply pass in an array of symbols representing the attributes you want
149
+ faceting for, alongside the search results you want faceted.
150
+
151
+ ```ruby
152
+ categories = [:name, :brand]
153
+ facets = GSA.facet(search_results, categories)
154
+
155
+ puts facets
156
+ # {:name => [["Foo", 1], ["Bar", 1]], :brand => [["BazBrand", 2]]}
157
+ ```
158
+
159
+ ### Faceting Results
160
+
161
+ The faceting method yields results in the following format:
162
+
163
+ ```ruby
164
+ {
165
+ :category_one =>
166
+ [
167
+ ["Cluster 1", amount_of_records_in_cluster],
168
+ ["Cluster 2", amount_of_records_in_cluster],
169
+ ["Cluster 3", amount_of_records_in_cluster]
170
+ ],
171
+ :category_two =>
172
+ [
173
+ ["Cluster 1", amount_of_records_in_cluster]
174
+ ]
175
+ }
176
+ ```
177
+
178
+ ## Copyright
179
+ Copyright (c) 2013 1000Bulbs.com.
180
+ See [LICENSE][] for details.
181
+
182
+ [license]: LICENSE.txt
@@ -18,7 +18,7 @@ module GSA
18
18
 
19
19
  # for creating attributes on tags
20
20
  def attributor(attributes)
21
- inject_s(attributes) {|key, value| " #{key.to_s}='#{value.to_s}'"}
21
+ inject_s(attributes) {|key, value| " #{key.to_s}=\"#{value.to_s}\""}
22
22
  end
23
23
  end
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module GSA
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gsa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Long
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-20 00:00:00.000000000 Z
12
+ date: 2013-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler