Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby, elasticsearch upgrades, and documentation #211

Merged
merged 13 commits into from
Mar 23, 2023
14 changes: 11 additions & 3 deletions lib/datura/to_es/webs_to_es/fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ def data_type
end

def date(before=true)
datestr = get_list(@xpaths["date"]).first
if get_list(@xpaths["date"])
datestr = get_list(@xpaths["date"]).first
else
datestr = nil
end
Comment on lines +42 to +46
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write this more briefly with a ternary, but no need to change it:

datestr = get_list(@xpaths["date"]) ? get_list(@xpaths["date"]).first : nil

if datestr
Datura::Helpers.date_standardize(datestr, true)
end
Expand Down Expand Up @@ -80,7 +84,9 @@ def format
end

def image_id
get_list(@xpaths["image_id"]).first
if get_list(@xpaths["image_id"])
get_list(@xpaths["image_id"]).first
end
end

def keywords
Expand Down Expand Up @@ -218,7 +224,9 @@ def works
# new/moved fields for API 2.0

def cover_image
get_list(@xpaths["image_id"]).first
if get_list(@xpaths["image_id"])
get_list(@xpaths["image_id"]).first
end
end

def date_updated
Expand Down