cncflora_commons 0.0.26 → 0.0.27
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.
- data/lib/cncflora_commons.rb +7 -7
- metadata +1 -1
data/lib/cncflora_commons.rb
CHANGED
@@ -59,10 +59,10 @@ def http_delete(uri)
|
|
59
59
|
JSON.parse(response.body)
|
60
60
|
end
|
61
61
|
|
62
|
-
def search(index,query)
|
62
|
+
def search(db,index,query)
|
63
63
|
query="scientificName:'Aphelandra longiflora'" unless query != nil && query.length > 0
|
64
64
|
result = []
|
65
|
-
r = http_get("#{settings.elasticsearch}/#{index}/_search?size=999&q=#{URI.encode(query)}")
|
65
|
+
r = http_get("#{settings.elasticsearch}/#{db}/#{index}/_search?size=999&q=#{URI.encode(query)}")
|
66
66
|
if r['hits'] && r['hits']['hits'] then
|
67
67
|
r['hits']['hits'].each{|hit|
|
68
68
|
result.push(hit["_source"])
|
@@ -155,20 +155,20 @@ def setup!(config)
|
|
155
155
|
config[:strings] = JSON.parse(File.read("src/locales/#{settings.lang}.json", :encoding => "BINARY"))
|
156
156
|
end
|
157
157
|
|
158
|
-
if ENV["
|
158
|
+
if ENV["DATAHUB_PORT_8080_TCP_ADDR"] then
|
159
159
|
config[:datahub] = "http://#{ENV["DATAHUB_PORT_8080_TCP_ADDR"]}:#{ENV["DATAHUB_PORT_8080_TCP_PORT"]}"
|
160
160
|
end
|
161
161
|
|
162
162
|
if config.has_key? :elasticsearch then
|
163
|
-
config[:elasticsearch] = "#{config[:elasticsearch]}
|
163
|
+
config[:elasticsearch] = "#{config[:elasticsearch]}"
|
164
164
|
else
|
165
|
-
config[:elasticsearch] = "#{config[:datahub]}
|
165
|
+
config[:elasticsearch] = "#{config[:datahub]}"
|
166
166
|
end
|
167
167
|
|
168
168
|
if config.has_key? :couchdb then
|
169
|
-
config[:couchdb] = "#{config[:couchdb]}
|
169
|
+
config[:couchdb] = "#{config[:couchdb]}"
|
170
170
|
else
|
171
|
-
config[:couchdb] = "#{config[:datahub]}
|
171
|
+
config[:couchdb] = "#{config[:datahub]}"
|
172
172
|
end
|
173
173
|
|
174
174
|
if settings.context then
|