solrb 0.2.6 → 0.2.7
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/.gitignore +2 -0
- data/lib/solr/query/request/boosting/dictionary_boost_function.rb +4 -3
- data/lib/solr/response/parser.rb +1 -1
- data/lib/solr/version.rb +1 -1
- metadata +2 -3
- data/Gemfile.lock +0 -83
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b698f0cc5aaf1aca1a12590a060170a79a3b27e4fb127db8cb033a824c9f3cc
|
4
|
+
data.tar.gz: 79dc166b65a24840210ab63cdbff757a9a0ddeaaa24c431e7a67e80b04e7f528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa4c469edc453402ddf80004e3e6f182688331b4d05e8ed126867aa568951ceccd66a3433bebede91f8f52a91f91b78b2fcabb4b0d5699002c384713e34b08c5
|
7
|
+
data.tar.gz: d46f7dbccc62f80ef3e59e0077fb3f59f35ed55ccc54e8d79e9bd0add7bd3a9fa288095afa5c3d875c5ca251c3c3d3aa2b933a48422d1aefe409f6224fc37d47
|
data/.gitignore
CHANGED
@@ -5,12 +5,13 @@ module Solr
|
|
5
5
|
class DictionaryBoostFunction
|
6
6
|
include Solr::Support::SchemaHelper
|
7
7
|
using Solr::Support::StringExtensions
|
8
|
-
attr_reader :field, :dictionary
|
8
|
+
attr_reader :field, :dictionary, :default_boost
|
9
9
|
|
10
|
-
def initialize(field:, dictionary:)
|
10
|
+
def initialize(field:, dictionary:, default_boost: 1)
|
11
11
|
raise 'dictionary must be a non-empty Hash' if Hash(dictionary).empty?
|
12
12
|
@field = field
|
13
13
|
@dictionary = dictionary
|
14
|
+
@default_boost = default_boost
|
14
15
|
end
|
15
16
|
|
16
17
|
# example: given a hash (dictionary)
|
@@ -21,7 +22,7 @@ module Solr
|
|
21
22
|
# note that I added spaces for readability, real Solr query functions must always be w/out spaces
|
22
23
|
def to_solr_s
|
23
24
|
sf = solarize_field(field)
|
24
|
-
dictionary.to_a.reverse.reduce(
|
25
|
+
dictionary.to_a.reverse.reduce(default_boost) do |acc, (field_value, boost)|
|
25
26
|
if field_value.is_a?(String) || field_value.is_a?(Symbol)
|
26
27
|
"if(termfreq(#{sf},\"#{field_value.to_s.solr_escape}\"),#{boost},#{acc})"
|
27
28
|
else
|
data/lib/solr/response/parser.rb
CHANGED
@@ -12,7 +12,7 @@ module Solr
|
|
12
12
|
def call
|
13
13
|
# 404 is a special case, it didn't hit Solr (more likely than not)
|
14
14
|
return not_found_response if @raw_response.status == 404
|
15
|
-
parsed_body = JSON.parse(@raw_response.body).freeze
|
15
|
+
parsed_body = @raw_response.body ? JSON.parse(@raw_response.body).freeze : {}
|
16
16
|
http_status = parse_http_status
|
17
17
|
header = parse_header(parsed_body)
|
18
18
|
solr_error = parse_solr_error(parsed_body)
|
data/lib/solr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adriano Luz
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-02-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -167,7 +167,6 @@ files:
|
|
167
167
|
- ".rspec"
|
168
168
|
- ".rubocop.yml"
|
169
169
|
- Gemfile
|
170
|
-
- Gemfile.lock
|
171
170
|
- LICENSE.txt
|
172
171
|
- README.md
|
173
172
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
solrb (0.2.5)
|
5
|
-
addressable
|
6
|
-
faraday
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.6.0)
|
12
|
-
public_suffix (>= 2.0.2, < 4.0)
|
13
|
-
ast (2.4.0)
|
14
|
-
byebug (10.0.2)
|
15
|
-
coderay (1.1.2)
|
16
|
-
diff-lcs (1.3)
|
17
|
-
docile (1.3.1)
|
18
|
-
faraday (0.15.4)
|
19
|
-
multipart-post (>= 1.2, < 3)
|
20
|
-
jaro_winkler (1.5.1)
|
21
|
-
json (2.1.0)
|
22
|
-
method_source (0.9.0)
|
23
|
-
multipart-post (2.0.0)
|
24
|
-
parallel (1.12.1)
|
25
|
-
parser (2.5.1.2)
|
26
|
-
ast (~> 2.4.0)
|
27
|
-
powerpack (0.1.2)
|
28
|
-
pry (0.11.3)
|
29
|
-
coderay (~> 1.1.0)
|
30
|
-
method_source (~> 0.9.0)
|
31
|
-
pry-byebug (3.6.0)
|
32
|
-
byebug (~> 10.0)
|
33
|
-
pry (~> 0.10)
|
34
|
-
public_suffix (3.0.3)
|
35
|
-
rainbow (3.0.0)
|
36
|
-
rake (10.5.0)
|
37
|
-
rspec (3.8.0)
|
38
|
-
rspec-core (~> 3.8.0)
|
39
|
-
rspec-expectations (~> 3.8.0)
|
40
|
-
rspec-mocks (~> 3.8.0)
|
41
|
-
rspec-core (3.8.0)
|
42
|
-
rspec-support (~> 3.8.0)
|
43
|
-
rspec-expectations (3.8.1)
|
44
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.8.0)
|
46
|
-
rspec-mocks (3.8.0)
|
47
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.8.0)
|
49
|
-
rspec-support (3.8.0)
|
50
|
-
rspec_junit_formatter (0.4.1)
|
51
|
-
rspec-core (>= 2, < 4, != 2.12.0)
|
52
|
-
rubocop (0.59.1)
|
53
|
-
jaro_winkler (~> 1.5.1)
|
54
|
-
parallel (~> 1.10)
|
55
|
-
parser (>= 2.5, != 2.5.1.1)
|
56
|
-
powerpack (~> 0.1)
|
57
|
-
rainbow (>= 2.2.2, < 4.0)
|
58
|
-
ruby-progressbar (~> 1.7)
|
59
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
60
|
-
ruby-progressbar (1.10.0)
|
61
|
-
simplecov (0.16.1)
|
62
|
-
docile (~> 1.1)
|
63
|
-
json (>= 1.8, < 3)
|
64
|
-
simplecov-html (~> 0.10.0)
|
65
|
-
simplecov-html (0.10.2)
|
66
|
-
unicode-display_width (1.4.0)
|
67
|
-
|
68
|
-
PLATFORMS
|
69
|
-
ruby
|
70
|
-
|
71
|
-
DEPENDENCIES
|
72
|
-
bundler (~> 1.16)
|
73
|
-
pry
|
74
|
-
pry-byebug
|
75
|
-
rake (~> 10.0)
|
76
|
-
rspec (~> 3.0)
|
77
|
-
rspec_junit_formatter
|
78
|
-
rubocop
|
79
|
-
simplecov
|
80
|
-
solrb!
|
81
|
-
|
82
|
-
BUNDLED WITH
|
83
|
-
1.17.3
|