juicer-client 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/juicer.rb +12 -8
- data/lib/juicer/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdb73311c4a89561de69bc19fddb8cb331ba73b5
|
4
|
+
data.tar.gz: e33e77dfc8afd4a9b7d4a34e14c69bb43c5fc7ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c80f07b3b4d8c8813ee0e27c81db565838f15697823f4e65d2d0394386b7518f789ccafc874148a01451f5ebf93f97e1524a38c78ac01f39ec6710947458b38b
|
7
|
+
data.tar.gz: 87572ae27003b4694908e9f4d2b22d0dfba9be7a0726a3b1391dfc67030dade09156276e65c42f865e0edefe1b3b60ea8dea9c7a33e6e8b90d9c66959f2e4a94
|
data/lib/juicer.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# @author Karl Sutt
|
2
|
+
require 'juicer/client'
|
2
3
|
|
3
4
|
class Juicer
|
4
5
|
|
@@ -50,6 +51,7 @@ class Juicer
|
|
50
51
|
# of results.
|
51
52
|
#
|
52
53
|
# @param opts [Hash] a Hash of filter options.
|
54
|
+
#
|
53
55
|
# Possible keys are:
|
54
56
|
#
|
55
57
|
# * `text` - a search term, corresponds to Lucene syntax.
|
@@ -79,15 +81,16 @@ class Juicer
|
|
79
81
|
# find semantically similar documents.
|
80
82
|
#
|
81
83
|
# @param cps_id [String] the `cps_id` of an article.
|
82
|
-
# @param opts [Hash] a Hash of query options
|
84
|
+
# @param opts [Hash] a Hash of query options.
|
85
|
+
#
|
83
86
|
# Possible keys are:
|
84
87
|
#
|
85
88
|
# * `size` - how many results to return. Results are ordered by their
|
86
89
|
# "match" score, i.e how similar they are to a given article, and the
|
87
90
|
# top `size` results are returned.
|
88
|
-
# * `product` -
|
89
|
-
# @return [Array<Hash>] list of similar articles.
|
90
|
-
#
|
91
|
+
# * `product` - a list of products to scope to. See {#products}.
|
92
|
+
# @return [Array<Hash>] list of similar articles. Defaults to 10 most similar
|
93
|
+
# across all products.
|
91
94
|
#
|
92
95
|
def similar_articles(cps_id, opts = {})
|
93
96
|
@client.request(:get, "articles/#{cps_id}/similar", opts)["results"]
|
@@ -97,15 +100,16 @@ class Juicer
|
|
97
100
|
# algorithm to find semantically similar documents.
|
98
101
|
#
|
99
102
|
# @param text [String] a blob of text.
|
100
|
-
# @param opts [Hash] a Hash of query options
|
103
|
+
# @param opts [Hash] a Hash of query options.
|
104
|
+
#
|
101
105
|
# Possible keys are:
|
102
106
|
#
|
103
107
|
# * `size` - how many results to return. Results are ordered by their
|
104
108
|
# "match" score, i.e how similar they are to the given blob of text, and
|
105
109
|
# the top `size` results are returned.
|
106
|
-
# * `product` -
|
107
|
-
# @return [Array<Hash>] list of similar articles.
|
108
|
-
#
|
110
|
+
# * `product` - a list of products to scope to. See {#products}.
|
111
|
+
# @return [Array<Hash>] list of similar articles. Defaults to 10 most similar
|
112
|
+
# across all products.
|
109
113
|
#
|
110
114
|
def similar_to(text, opts = {})
|
111
115
|
body = { like_text: URI.encode(text) }.to_json
|
data/lib/juicer/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: juicer-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Sutt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpi
|