jgm-cloudlib 0.2.4 → 0.2.5
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/cloudlib.gemspec +1 -1
- data/lib/cloudlib.rb +21 -17
- metadata +1 -1
data/cloudlib.gemspec
CHANGED
data/lib/cloudlib.rb
CHANGED
@@ -143,26 +143,30 @@ class Entry
|
|
143
143
|
# if their titles contain both word1 and word2.
|
144
144
|
def self.query(query_string, numitems=10, token=nil)
|
145
145
|
query_parts = query_string.downcase.scan(/((ti(?:tle)?|au(?:thors?)?|jo(?:urnal)?|bo(?:ooktitle)?|pu(?:blisher)?|ad(?:ddress)?|ed(?:itors?)?|ye(?:ar)?)\s*([<=>])\s*('[^']*'|"[^"]*"|\S*)|\S+)\s*/)
|
146
|
-
query = query_parts.reject {|part| part
|
146
|
+
query = query_parts.reject {|part| part[0] == '*'}.map do |part|
|
147
147
|
whole, key, comparison, val = part
|
148
148
|
if val then val = val.gsub(/^['"](.*)['"]$/, "\\1") end
|
149
149
|
if not val then val = whole end
|
150
|
-
key_full =
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
150
|
+
key_full = if key
|
151
|
+
case key[0..1]
|
152
|
+
when 'ti'
|
153
|
+
'title'
|
154
|
+
when 'au'
|
155
|
+
'authors'
|
156
|
+
when 'jo'
|
157
|
+
'journal'
|
158
|
+
when 'pu'
|
159
|
+
'publisher'
|
160
|
+
when 'ad'
|
161
|
+
'address'
|
162
|
+
when 'ed'
|
163
|
+
'editors'
|
164
|
+
when 'ye'
|
165
|
+
'year'
|
166
|
+
else 'all'
|
167
|
+
end
|
168
|
+
else
|
169
|
+
'all'
|
166
170
|
end
|
167
171
|
vals = val.split
|
168
172
|
vals.map do |v|
|