Skip to content

Commit

Permalink
DACCESS-360 - dry up simple search SearchBuilder logic
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrlc committed Dec 9, 2024
1 parent 200b0fd commit dd8374c
Show file tree
Hide file tree
Showing 8 changed files with 830 additions and 1,014 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
class AdvancedSearchController < ApplicationController
# drop down problems?
#
#include Blacklight::Catalog
#include BlacklightCornell::CornellCatalog

include LoggingHelper

delegate :blacklight_config, to: :default_catalog_controller
Expand Down
173 changes: 65 additions & 108 deletions blacklight-cornell/app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ def authorize_email_use!


config.add_facet_field 'acquired_dt_query', label: 'Date Acquired', query: {
last_1_week: { label: 'Since last week', fq: "acquired_dt:[NOW-14DAY TO NOW-7DAY ]"},
last_1_month: { label: 'Since last month', fq: "acquired_dt:[NOW-30DAY TO NOW-7DAY ]"},
last_1_week: { label: 'Since last week', fq: "acquired_dt:[NOW-14DAY TO NOW-7DAY]"},
last_1_month: { label: 'Since last month', fq: "acquired_dt:[NOW-30DAY TO NOW-7DAY]"},
last_1_years: { label: 'Since last year', fq: "acquired_dt:[NOW-1YEAR TO NOW-7DAY]"}
}, if: :has_search_parameters?

Expand Down Expand Up @@ -584,138 +584,95 @@ def authorize_email_use!
# }
#end

#combined author CTS field made from the multiple author browse fields
config.add_search_field('author_cts',:label=>'Author/Contributor') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => '$author_cts_qf',
# :pf => '$author_cts_pf'
# }
# Combined author CTS (Click to Search) field made from the multiple author browse fields
# Linked from catalog record pages
config.add_search_field('author_cts') do |field|
field.label = 'Author/Contributor'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

#combined subject CTS field made from the multiple subject browse fields
config.add_search_field('subject_cts',:label=>'Subject') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => '$subject_cts_qf',
# :pf => '$subject_cts_pf'
# }
# Combined subject CTS field made from the multiple subject browse fields
# Linked from catalog record pages
config.add_search_field('subject_cts') do |field|
field.label = 'Subject'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

#browse CTS fields. they do not appear in simple or advanced drop downs.
config.add_search_field('author_pers_browse',:label=>'Author: Personal Name') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'author_pers_browse',
# :pf => 'author_pers_browse'
# }
# Browse CTS fields linked to from the browse info pages
config.add_search_field('author_pers_browse') do |field|
field.label = 'Author: Personal Name'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('author_corp_browse', :label=>'Author: Corporate Name') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'author_corp_browse',
# :pf => 'author_corp_browse'
# }
config.add_search_field('author_corp_browse') do |field|
field.label = 'Author: Corporate Name'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('author_event_browse', :label=>'Author: Event') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'author_event_browse',
# :pf => 'author_event_browse'
# }
config.add_search_field('author_event_browse') do |field|
field.label = 'Author: Event'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end
config.add_search_field('subject_pers_browse', :label => 'Subject: Personal Name') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'subject_pers_browse',
# :pf => 'subject_pers_browse'
# }

config.add_search_field('subject_pers_browse') do |field|
field.label = 'Subject: Personal Name'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('subject_corp_browse', :label => 'Subject: Corporate Name') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'subject_corp_browse',
# :pf => 'subject_corp_browse'
# }
config.add_search_field('subject_corp_browse') do |field|
field.label = 'Subject: Corporate Name'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('subject_event_browse', :label => 'Subject: Event') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'subject_event_browse',
# :pf => 'subject_event_browse'
# }
config.add_search_field('subject_event_browse') do |field|
field.label = 'Subject: Event'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('subject_topic_browse', :label => 'Subject: Topic Term') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'subject_topic_browse',
# :pf => 'subject_topic_browse'
# }
config.add_search_field('subject_topic_browse') do |field|
field.label = 'Subject: Topic Term'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('subject_era_browse', :label => 'Subject: Chronological Term') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'subject_era_browse',
# :pf => 'subject_era_browse'
# }
config.add_search_field('subject_era_browse') do |field|
field.label = 'Subject: Chronological Term'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('subject_genr_browse', :label => 'Subject: Genre/Form Term') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'subject_genr_browse',
# :pf => 'subject_genr_browse'
# }
config.add_search_field('subject_genr_browse') do |field|
field.label = 'Subject: Genre/Form Term'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('subject_geo_browse', :label => 'Subject: Geographic Name') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'subject_geo_browse',
# :pf => 'subject_geo_browse'
# }
config.add_search_field('subject_geo_browse') do |field|
field.label = 'Subject: Geographic Name'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

config.add_search_field('subject_work_browse', :label => 'Subject: Work') do |field|
field.include_in_simple_select = false
field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'subject_work_browse',
# :pf => 'subject_work_browse'
# }
config.add_search_field('subject_work_browse') do |field|
field.label = 'Subject: Work'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

# config.add_search_field('authortitle_browse', :label => 'Author (sorted by title)') do |field|
# field.include_in_simple_select = false
# field.include_in_advanced_search = false
# field.solr_local_parameters = {
# :qf => 'authortitle_browse',
# :pf => 'authortitle_browse'
# }
# end
config.add_search_field('authortitle_browse') do |field|
field.label = 'Author (sorted by title)'
field.include_in_simple_select = false
field.include_in_advanced_search = false
end

# config.add_search_field('donor name') do |field|
# field.include_in_simple_select = false
# field.solr_parameters = { :qf => '$donor_t' }
# end
# "sort results by" select (pulldown)
# label in pulldown is followed by the name of the SOLR field to sort by and
# whether the sort is ascending or descending (it must be asc or desc
Expand Down
Loading

0 comments on commit dd8374c

Please sign in to comment.