lsh 0.3.0-java → 0.3.1-java

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 (2) hide show
  1. data/lib/lsh/web.rb +7 -1
  2. metadata +2 -2
data/lib/lsh/web.rb CHANGED
@@ -24,7 +24,13 @@ module LSH
24
24
  if mime_type == 'application/json'
25
25
  t0 = Time.now
26
26
  vector = JSON.parse(params[:data])
27
- results = index.query(vector, params[:radius] || 0)
27
+ result_vectors = index.query(vector, params[:radius] || 0)
28
+ results = []
29
+ if params[:include] == 'id'
30
+ result_vectors.each { |v| results << { :id => index.vector_to_id(v), :data => v } }
31
+ else
32
+ result_vectors.each { |v| results << { :data => v } }
33
+ end
28
34
  content_type :json
29
35
  { "time" => Time.now - t0, "results" => results }.to_json
30
36
  else
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: lsh
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.3.1
6
6
  platform: java
7
7
  authors:
8
8
  - Yves Raimond
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-04 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jblas-ruby