Skip to content

Commit

Permalink
use only doi or url with wordpress. #213
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 4, 2015
1 parent 9b25826 commit 71a067f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/source.rb
Expand Up @@ -270,7 +270,7 @@ def get_events_url(work)
def get_query_string(work)
return {} unless work.get_url || work.doi.present?

[work.doi, work.canonical_url].compact.map { |i| CGI.escape("\"#{i}\"") }.join("+OR+")
[work.doi, work.canonical_url].compact.map { |i| "%22#{i}%22)" }.join("+OR+")
end

# fields with urls, not user-configurable
Expand Down
4 changes: 4 additions & 0 deletions app/models/sources/reddit.rb
Expand Up @@ -60,4 +60,8 @@ def job_batch_size
def rate_limiting
config.rate_limiting || 1800
end

def queue
config.queue || "low"
end
end
4 changes: 4 additions & 0 deletions app/models/sources/wordpress.rb
@@ -1,4 +1,8 @@
class Wordpress < Source
def get_query_string(work)
work.doi.presence || work.canonical_url.presence
end

def get_related_works(result, work)
result['data'] = nil if result['data'].is_a?(String)
Array(result.fetch("data", nil)).map do |item|
Expand Down

0 comments on commit 71a067f

Please sign in to comment.