solr_lite 0.0.17 → 0.0.18

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.
Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/lib/search_params.rb +16 -0
  3. data/lib/solr.rb +7 -3
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 790395ac5299c63c4099d956ae704cdf62f1800888fae5a5eb42c00cbc8de8ba
4
- data.tar.gz: e1ce985a2dd79b6647461b05faf1ac3ff8cb1f5daaab76a2a747953d4938538a
2
+ SHA1:
3
+ metadata.gz: 9d3e98c34609bc57613afad765b11e2133809da5
4
+ data.tar.gz: dff5de790a389e362c32d2256e79ef324c70db4b
5
5
  SHA512:
6
- metadata.gz: dac3c0be0e6b7e0583ad3be592aa01c67346e93cdc3be2916b7f81a68ce0b4f34dca5efb3368cc7393aa1e91507d89e06b24e72af094de3f182d86eff4055856
7
- data.tar.gz: 52b55eb7a17770a32c229e2914832e8d2ddb3bd4180c5151184e076698fbbdd81f78b2b1d59ab58bf92c4248966fea90ddfe43bcad902e736527c20da926a81e
6
+ metadata.gz: cd782b09b42a885272d359d370fd3fb6e2b4d4f8e322e0d134f4dfb77ffb516594c4994d049c5c16678b19ee9143ef7e1a892fac0d87f4a3ddb92aa5af49cdc3
7
+ data.tar.gz: 8462ddab0645f0c005e3d444d55ca64421b78cf3b85e00f3e8e689fb25febdfc316a68246b28a6a9906a6d471fd4a0cd4c9c88a3971852822628b96baa7b3b2c
@@ -46,6 +46,12 @@ module SolrLite
46
46
  # in a grouped request. Defaults to "group_count", set to nil to omit.
47
47
  attr_accessor :group_count
48
48
 
49
+ # [String] Sets the qf value to pass to Solr.
50
+ attr_accessor :qf
51
+
52
+ # [String] Sets the pf value to pass to Solr.
53
+ attr_accessor :pf
54
+
49
55
  DEFAULT_PAGE_SIZE = 20
50
56
 
51
57
  # Creates an instance of the SearchParams class.
@@ -69,6 +75,8 @@ module SolrLite
69
75
  @hl_fl = nil
70
76
  @hl_snippets = 1
71
77
  @group_count = "group_count"
78
+ @qf = nil
79
+ @pf = nil
72
80
  end
73
81
 
74
82
  # Returns facet information about a given field.
@@ -180,6 +188,14 @@ module SolrLite
180
188
  qs += "&sort=#{CGI.escape(@sort)}"
181
189
  end
182
190
 
191
+ if @qf != nil
192
+ qs += "&qf=#{@qf}"
193
+ end
194
+
195
+ if @pf != nil
196
+ qs += "&pf=#{@pf}"
197
+ end
198
+
183
199
  if @spellcheck
184
200
  qs += "&spellcheck=on"
185
201
  end
@@ -95,8 +95,8 @@ module SolrLite
95
95
  response
96
96
  end
97
97
 
98
- def search_group(params, extra_fqs = [], qf = nil, mm = nil, debug = false, group_field, group_limit)
99
- http_response = search_core(params, extra_fqs, qf, mm, debug, group_field, group_limit)
98
+ def search_group(params, extra_fqs = [], qf = nil, mm = nil, debug = false, group_field = nil, group_limit = nil, group_extra = nil)
99
+ http_response = search_core(params, extra_fqs, qf, mm, debug, group_field, group_limit, group_extra)
100
100
  response = Response.new(http_response, params)
101
101
  response
102
102
  end
@@ -174,7 +174,7 @@ module SolrLite
174
174
  end
175
175
 
176
176
  private
177
- def search_core(params, extra_fqs, qf, mm, debug, group_field, group_limit)
177
+ def search_core(params, extra_fqs, qf, mm, debug, group_field, group_limit, group_extra = nil)
178
178
  if params.fl != nil
179
179
  query_string = "fl=#{params.fl.join(",")}"
180
180
  else
@@ -211,6 +211,10 @@ module SolrLite
211
211
  # and https://stackoverflow.com/a/56138991/446681
212
212
  query_string += '&json.facet={"' + params.group_count + '":"unique(' + group_field + ')"}'
213
213
  end
214
+
215
+ if group_extra != nil
216
+ query_string += "&#{group_extra}"
217
+ end
214
218
  end
215
219
 
216
220
  if @def_type != nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solr_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hector Correa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-17 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A lightweight gem to connect to Solr and run queries. Requires no extra
14
14
  dependencies.
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  version: '0'
48
48
  requirements: []
49
49
  rubyforge_project:
50
- rubygems_version: 2.7.7
50
+ rubygems_version: 2.6.14.1
51
51
  signing_key:
52
52
  specification_version: 4
53
53
  summary: A lightweight gem to connect to Solr and run queries