diff --git a/app/search_builders/umrdr/search_builder.rb b/app/search_builders/umrdr/search_builder.rb index 74700089..a99b8f35 100644 --- a/app/search_builders/umrdr/search_builder.rb +++ b/app/search_builders/umrdr/search_builder.rb @@ -3,19 +3,21 @@ class Umrdr::SearchBuilder < Sufia::SearchBuilder # show both works that match the query and works that contain files that match the query def show_works_or_works_that_contain_files(solr_parameters) return if solr_parameters[:q].blank? - extract_user_params(solr_parameters[:q]) solr_parameters[:user_query] = extract_user_query(solr_parameters[:q]) solr_parameters[:q] = new_query end protected - def extract_user_params(query) - @user_params = query.split('}')[0].split('{')[1].sub('!', '').sub('dismax ', '') - end - def extract_user_query(query) - query.split('}')[1] + @user_params = '' + user_params, user_query = query.split('}') + if user_query + @user_params = user_params.split('{')[1].sub('!', '').sub('dismax ', '') + else + user_query = user_params + end + user_query end # the {!dismax} causes the query to go against the query fields