Skip to content

Commit

Permalink
Merge pull request #2 from hudmol/refactor
Browse files Browse the repository at this point in the history
Refactor plugin to use new AdvancedSearch.define_field instead of enumerations
  • Loading branch information
marktriggs committed Jun 3, 2014
2 parents 7a69fb8 + a880ca6 commit 873410f
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 111 deletions.
73 changes: 37 additions & 36 deletions frontend/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
en:
enumerations:
staff_field_query_field:
accession_condition_description_u_utext: Condition Description
accession_content_description_u_utext: Content Description
accession_general_note_u_utext: General Note
accession_id_0_u_ustr: Fiscal Year
accession_id_1_u_ustr: Department
accession_inventory_u_utext: Inventory
accession_provenance_u_utext: Provenance
acquisition_type: Acquisition Type
agent_roles_u_ustr: Role
advanced_search:
text:
accession_condition_description: Condition Description
accession_content_description: Content Description
accession_general_note: General Note
accession_id_0: Fiscal Year
accession_id_1: Department
accession_inventory: Inventory
accession_provenance: Provenance
agents: Agent
collection_management_processors: Processors
created_by: Created By
enum_2_u_ustr: BRBL Owner
extent_container_summary_u_utext: Container Summary
extent_number_u_ustr: Number
extent_physical_details_u_utext: Physical Details
extent_type_u_ustr: Extent Type
extent_container_summary: Container Summary
extent_number: Number
extent_physical_details: Physical Details
last_modified_by: Last Modified By
string_3_u_ustr: Place of Publication
text_1_u_utext: Call Number
text_2_u_utext: Title Main Entry
text_3_u_utext: Monographic Series
text_4_u_utext: Plating Information
text_5_u_utext: Bibliographic Citation
collection_management_processing_priority_u_ustr: Priority
collection_management_processing_status_u_ustr: Processing Status
collection_management_processors_u_utext: Processors
event_type_u_ustr: Event Type
event_outcome_u_ustr: Event Outcome
boolean_field_query_field:
user_defined_string_3: Place of Publication
user_defined_text_1: Call Number
user_defined_text_2: Title Main Entry
user_defined_text_3: Monographic Series
user_defined_text_4: Plating Information
user_defined_text_5: Bibliographic Citation
date:
accession_date: Accession Date
date_begin: Begin
date_end: End
event_begin: Event Begin
event_end_u_udate: Event End
boolean:
access_restrictions: Access Restrictions?
has_external_documents_u_ubool: External Documents?
has_rights_statements_u_ubool: Rights Statements?
has_external_documents: External Documents?
has_rights_statements: Rights Statements?
restrictions_apply: Restrictions Apply?
use_restrictions: Use Restrictions?
date_field_query_field:
accession_date_u_udate: Accession Date
date_begin_u_udate: Begin
date_end_u_udate: End
event_begin_u_udate: Event Begin
event_end_u_udate: Event End
enum:
accession_acquisition_type: Acquisition Type
collection_management_processing_priority: Priority
collection_management_processing_status: Processing Status
event_event_type: Event Type
event_outcome: Event Outcome
extent_extent_type: Extent Type
linked_agent_role: Role
user_defined_enum_2: BRBL Owner
75 changes: 0 additions & 75 deletions migrations/002_modify_advanced_search_fields.rb

This file was deleted.

45 changes: 45 additions & 0 deletions search_definitions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Text fields
AdvancedSearch.define_field(:name => 'agents', :type => :text, :visibility => [:staff], :solr_field => 'agents')
AdvancedSearch.define_field(:name => 'created_by', :type => :text, :visibility => [:staff], :solr_field => 'created_by')
AdvancedSearch.define_field(:name => 'last_modified_by', :type => :text, :visibility => [:staff], :solr_field => 'last_modified_by')
AdvancedSearch.define_field(:name => 'accession_id_0', :type => :text, :visibility => [:staff], :solr_field => 'accession_id_0_u_ustr')
AdvancedSearch.define_field(:name => 'accession_id_1', :type => :text, :visibility => [:staff], :solr_field => 'accession_id_1_u_ustr')
AdvancedSearch.define_field(:name => 'accession_content_description', :type => :text, :visibility => [:staff], :solr_field => 'accession_content_description_u_utext')
AdvancedSearch.define_field(:name => 'accession_condition_description', :type => :text, :visibility => [:staff], :solr_field => 'accession_condition_description_u_utext')
AdvancedSearch.define_field(:name => 'accession_inventory', :type => :text, :visibility => [:staff], :solr_field => 'accession_inventory_u_utext')
AdvancedSearch.define_field(:name => 'accession_provenance', :type => :text, :visibility => [:staff], :solr_field => 'accession_provenance_u_utext')
AdvancedSearch.define_field(:name => 'accession_general_note', :type => :text, :visibility => [:staff], :solr_field => 'accession_general_note_u_utext')
AdvancedSearch.define_field(:name => 'extent_number', :type => :text, :visibility => [:staff], :solr_field => 'extent_number_u_ustr')
AdvancedSearch.define_field(:name => 'extent_container_summary', :type => :text, :visibility => [:staff], :solr_field => 'extent_container_summary_u_utext')
AdvancedSearch.define_field(:name => 'extent_physical_details', :type => :text, :visibility => [:staff], :solr_field => 'extent_physical_details_u_utext')
AdvancedSearch.define_field(:name => 'user_defined_string_3', :type => :text, :visibility => [:staff], :solr_field => 'string_3_u_ustr')
AdvancedSearch.define_field(:name => 'user_defined_text_1', :type => :text, :visibility => [:staff], :solr_field => 'text_1_u_utext')
AdvancedSearch.define_field(:name => 'user_defined_text_2', :type => :text, :visibility => [:staff], :solr_field => 'text_2_u_utext')
AdvancedSearch.define_field(:name => 'user_defined_text_3', :type => :text, :visibility => [:staff], :solr_field => 'text_3_u_utext')
AdvancedSearch.define_field(:name => 'user_defined_text_4', :type => :text, :visibility => [:staff], :solr_field => 'text_4_u_utext')
AdvancedSearch.define_field(:name => 'user_defined_text_5', :type => :text, :visibility => [:staff], :solr_field => 'text_5_u_utext')
AdvancedSearch.define_field(:name => 'collection_management_processors', :type => :text, :visibility => [:staff], :solr_field => 'collection_management_processors_u_utext')

# Booleans
AdvancedSearch.define_field(:name => 'restrictions_apply', :type => :boolean, :visibility => [:staff], :solr_field => 'restrictions_apply')
AdvancedSearch.define_field(:name => 'access_restrictions', :type => :boolean, :visibility => [:staff], :solr_field => 'access_restrictions')
AdvancedSearch.define_field(:name => 'use_restrictions', :type => :boolean, :visibility => [:staff], :solr_field => 'use_restrictions')
AdvancedSearch.define_field(:name => 'has_external_documents', :type => :boolean, :visibility => [:staff], :solr_field => 'has_external_documents')
AdvancedSearch.define_field(:name => 'has_rights_statements', :type => :boolean, :visibility => [:staff], :solr_field => 'has_rights_statements_u_ubool')

# Dates
AdvancedSearch.define_field(:name => 'date_begin', :type => :date, :visibility => [:staff], :solr_field => 'date_begin_u_udate')
AdvancedSearch.define_field(:name => 'date_end', :type => :date, :visibility => [:staff], :solr_field => 'date_end_u_udate')
AdvancedSearch.define_field(:name => 'accession_date', :type => :date, :visibility => [:staff], :solr_field => 'accession_date_u_udate')
AdvancedSearch.define_field(:name => 'event_begin', :type => :date, :visibility => [:staff], :solr_field => 'event_begin_u_udate')
AdvancedSearch.define_field(:name => 'event_end', :type => :date, :visibility => [:staff], :solr_field => 'event_end_u_udate')

# Enums
AdvancedSearch.define_field(:name => 'accession_acquisition_type', :type => :enum, :visibility => [:staff], :solr_field => 'acquisition_type')
AdvancedSearch.define_field(:name => 'extent_extent_type', :type => :enum, :visibility => [:staff], :solr_field => 'extent_type_u_ustr')
AdvancedSearch.define_field(:name => 'user_defined_enum_2', :type => :enum, :visibility => [:staff], :solr_field => 'enum_2_u_ustr')
AdvancedSearch.define_field(:name => 'linked_agent_role', :type => :enum, :visibility => [:staff], :solr_field => 'agent_roles_u_ustr')
AdvancedSearch.define_field(:name => 'collection_management_processing_priority', :type => :enum, :visibility => [:staff], :solr_field => 'collection_management_processing_priority_u_ustr')
AdvancedSearch.define_field(:name => 'collection_management_processing_status', :type => :enum, :visibility => [:staff], :solr_field => 'collection_management_processing_status_u_ustr')
AdvancedSearch.define_field(:name => 'event_event_type', :type => :enum, :visibility => [:staff], :solr_field => 'event_type_u_ustr')
AdvancedSearch.define_field(:name => 'event_outcome', :type => :enum, :visibility => [:staff], :solr_field => 'event_outcome_u_ustr')

0 comments on commit 873410f

Please sign in to comment.