Skip to content

Commit

Permalink
support camelCase field names in queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jan 4, 2019
1 parent 0d1dfdc commit d85bf52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,18 @@ def query(query, options={})
# currently not used
# fields = options[:query_fields].presence || query_fields

# make sure field name uses underscore
# escape forward slashes in query
query = query.gsub("/", '\/') if query.present?
if query.present?
query = query.gsub(/publicationYear/, "publication_year")
query = query.gsub(/relatedIdentifiers/, "related_identifiers")
query = query.gsub(/rightsList/, "rights_list")
query = query.gsub(/fundingReferences/, "funding_references")
query = query.gsub(/geoLocations/, "geo_locations")
query = query.gsub(/landingPage/, "landing_page")
query = query.gsub(/contentUrl/, "content_url")
query = query.gsub("/", '\/')
end

must = []
must << { query_string: { query: query }} if query.present?
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/_version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Lupo
class Application
VERSION = "2.3.1"
VERSION = "2.3.2"
end
end

0 comments on commit d85bf52

Please sign in to comment.