class Curate::SearchConfigGenerator

Constants

AGGREGATE_CONFIG
COPYFIELD_CONFIG
EDGE_FILTER_CONFIG
FINAL_STATUS
JETTY_SOLR_QUESTION
NGRAM_QUESTION
PARTIAL_SEARCH_QUESTION

Public Instance Methods

config_edge_filters() click to toggle source
# File lib/generators/curate/search_config/search_config_generator.rb, line 121
def config_edge_filters
  myfile = Rails.root.join("solr_conf","conf","schema.xml")
  config_target = /.*A text field with defaults appropriate for English --\>\n/
  say_status(".....", "Configuring SOLR with an EdgeNGramFilterFactory field type", :green)
  say_status(".....", "Making changes to "+myfile.to_s, :green)
  inject_into_file myfile, EDGE_FILTER_CONFIG, before: config_target
end
copy_solr_configs() click to toggle source
# File lib/generators/curate/search_config/search_config_generator.rb, line 155
def copy_solr_configs
  my_solr_path = "solr_conf/conf"  
  my_jetty_dev_path = Rails.root.join("jetty","solr","development-core","conf")
  my_jetty_test_path = Rails.root.join("jetty","solr","test-core","conf")
  if File.directory?(Rails.root+"jetty")
    if yes_with_banner?(JETTY_SOLR_QUESTION)
      say_status(".....", "Copying SOLR config files to Jetty", :green)
      copy_file my_solr_path+"/schema.xml", my_jetty_dev_path+"schema.xml", force: true
      copy_file my_solr_path+"/schema.xml", my_jetty_test_path+"schema.xml", force: true
      copy_file my_solr_path+"/solrconfig.xml", my_jetty_dev_path+"solrconfig.xml", force: true
      copy_file my_solr_path+"/solrconfig.xml", my_jetty_test_path+"solrconfig.xml", force: true
    end
  end
end
final_status() click to toggle source
# File lib/generators/curate/search_config/search_config_generator.rb, line 170
def final_status
  banner = "\n" + "*" * 80 + "\n"
  puts banner
  say_status("Finished",FINAL_STATUS, :green)
  puts banner
end
prepare_yaml_file() click to toggle source
# File lib/generators/curate/search_config/search_config_generator.rb, line 110
def prepare_yaml_file
  banner = "\n" + "*" * 80 + "\n"
  puts banner
  say_status("Preparing","Preparing search configuration files...", :green)
  puts banner
  yamlfile = Rails.root.join("config","search_config.yml")
  qt_option = "    qt: search\n"
  inject_into_file yamlfile, qt_option, after: /.*.\scatalog:\n/, force: true
  inject_into_file yamlfile, qt_option, after: /.*.\speople:\n/, force: true
end