quick_search-core 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -55
  3. data/Rakefile +30 -4
  4. data/app/assets/javascripts/quick_search/event_tracking.js.erb +2 -8
  5. data/app/assets/stylesheets/{quick_search.css.scss.erb → quick_search.scss.erb} +0 -0
  6. data/app/assets/stylesheets/quick_search/{appstats.css.scss → appstats.scss} +0 -0
  7. data/app/assets/stylesheets/quick_search/{opensearch.css.scss → opensearch.scss} +0 -0
  8. data/app/assets/stylesheets/quick_search/{pages.css.scss → pages.scss} +0 -0
  9. data/app/assets/stylesheets/quick_search/{quick_search.css.scss → quick_search.scss} +1 -0
  10. data/app/assets/stylesheets/quick_search/{search.css.scss → search.scss} +0 -0
  11. data/app/controllers/concerns/quick_search/searcher_concern.rb +8 -1
  12. data/app/controllers/concerns/quick_search/searcher_config.rb +5 -2
  13. data/app/controllers/quick_search/appstats_controller.rb +2 -2
  14. data/app/controllers/quick_search/search_controller.rb +7 -7
  15. data/app/models/application_record.rb +3 -0
  16. data/app/models/event.rb +1 -1
  17. data/app/models/search.rb +1 -1
  18. data/app/searchers/quick_search/best_bets_searcher.rb +25 -7
  19. data/app/views/layouts/quick_search/_google_analytics.html.erb +0 -9
  20. data/lib/generators/quick_search/install_generator.rb +101 -0
  21. data/lib/generators/quick_search/templates/best_bets.yml +86 -0
  22. data/lib/generators/quick_search/templates/post_install.txt +3 -1
  23. data/lib/generators/quick_search/templates/quick_search_config.yml +25 -3
  24. data/lib/quick_search.rb +0 -2
  25. data/lib/quick_search/engine.rb +16 -1
  26. data/lib/quick_search/version.rb +1 -1
  27. data/lib/tasks/best_bets.rake +2 -0
  28. data/test/controllers/concerns/doi_trap_test.rb +3 -3
  29. data/test/controllers/concerns/on_campus_test.rb +4 -4
  30. data/test/controllers/concerns/query_parser_test.rb +6 -6
  31. data/test/controllers/{appstats_controller_test.rb → quick_search/appstats_controller_test.rb} +1 -1
  32. data/test/controllers/{opensearch_controller_test.rb → quick_search/opensearch_controller_test.rb} +6 -1
  33. data/test/controllers/{pages_controller_test.rb → quick_search/pages_controller_test.rb} +1 -1
  34. data/test/controllers/quick_search/search_controller_test.rb +15 -0
  35. data/test/dummy/README.rdoc +28 -0
  36. data/test/dummy/Rakefile +6 -0
  37. data/test/dummy/app/assets/javascripts/application.js +13 -0
  38. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  39. data/test/dummy/app/controllers/application_controller.rb +5 -0
  40. data/test/dummy/app/helpers/application_helper.rb +2 -0
  41. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  42. data/test/dummy/bin/bundle +3 -0
  43. data/test/dummy/bin/rails +4 -0
  44. data/test/dummy/bin/rake +4 -0
  45. data/test/dummy/config.ru +4 -0
  46. data/{config → test/dummy/config}/application.rb +6 -8
  47. data/test/dummy/config/best_bets.yml +86 -0
  48. data/test/dummy/config/boot.rb +5 -0
  49. data/test/dummy/config/database.yml +25 -0
  50. data/test/dummy/config/environment.rb +5 -0
  51. data/test/dummy/config/environments/development.rb +37 -0
  52. data/test/dummy/config/environments/production.rb +78 -0
  53. data/test/dummy/config/environments/test.rb +39 -0
  54. data/test/dummy/config/initializers/assets.rb +8 -0
  55. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  57. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  58. data/test/dummy/config/initializers/inflections.rb +16 -0
  59. data/test/dummy/config/initializers/mime_types.rb +4 -0
  60. data/test/dummy/config/initializers/session_store.rb +3 -0
  61. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  62. data/test/dummy/config/locales/en.yml +23 -0
  63. data/test/dummy/config/quick_search_config.yml +58 -0
  64. data/test/dummy/config/routes.rb +6 -0
  65. data/test/dummy/config/secrets.yml +22 -0
  66. data/test/dummy/db/schema.rb +31 -0
  67. data/test/dummy/db/test.sqlite3 +0 -0
  68. data/test/dummy/log/benchmark.log +241 -0
  69. data/test/dummy/log/test.log +4762 -0
  70. data/test/dummy/public/404.html +67 -0
  71. data/test/dummy/public/422.html +67 -0
  72. data/test/dummy/public/500.html +66 -0
  73. data/test/dummy/public/favicon.ico +0 -0
  74. data/test/dummy/tmp/cache/assets/sprockets/v3.0/0_/0_w_ydOOEFQOoETxJa-IxKppQocaiDwM5V08djCPYso.cache +3 -0
  75. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1n/1nStVaWIQEwAlksUpB1fInwq6v3TikPvuRaSwwCnCLQ.cache +1 -0
  76. data/test/dummy/tmp/cache/assets/sprockets/v3.0/3m/3mWfBeEpm_bJvaPQZYvnnAVtE_2helOWh_Tv-cEflrk.cache +5 -0
  77. data/test/dummy/tmp/cache/assets/sprockets/v3.0/4s/4sg52OgD5l4qx4GnojCVxg2itqwqb-KRanEdmdMus3Y.cache +0 -0
  78. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5U/5UPnsccuZFLk9OqbmFMvB55mbvGptApx9Z55HWjEN90.cache +3 -0
  79. data/test/dummy/tmp/cache/assets/sprockets/v3.0/9a/9acKNgyVD8_WK401tMy6Ce98g-LS4VpwFvGQdzCV9mI.cache +0 -0
  80. data/test/dummy/tmp/cache/assets/sprockets/v3.0/B5/B5ptGSZGmgHvoK2UDCAtpMhWxJEKxKFhyL9ACeBfzQk.cache +1 -0
  81. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ba/BaymviI8cwAJQMOIzWCf6Lt-PM2sNFTvY9hQKsfDNNw.cache +3 -0
  82. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Dd/DdFHg3C_voetfvKGKX7t8PGzZlkO45-huHNtaou5rxg.cache +1 -0
  83. data/test/dummy/tmp/cache/assets/sprockets/v3.0/F0/F0oWBwLHpGFYNNtnGav-dJFH8rMDpNA5L8_aWm5Wq34.cache +0 -0
  84. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Fp/FprCQeeZguht46WNSpA3Y3JHKehovFXrj63nDrvvwFE.cache +1 -0
  85. data/test/dummy/tmp/cache/assets/sprockets/v3.0/GJ/GJrfWiarIi0Dt6sdKVMfUF1cdZ6NbqZxXHhzNbFtpBw.cache +1 -0
  86. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Gp/GpoziOxxB-hisco0rl7Nnsnw0UWud7R9Yge2Q3o1eN4.cache +2 -0
  87. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Hr/Hr-kCuPY72nIKAdnsDTz9JqXd_z1WL6FSGMAq4HppZg.cache +1 -0
  88. data/test/dummy/tmp/cache/assets/sprockets/v3.0/It/It5VkJv-53-LICLKZWWyp2WcbD86DGotAL0MY3hhfpg.cache +6 -0
  89. data/test/dummy/tmp/cache/assets/sprockets/v3.0/MA/MAY_nSUZSFcwPf9b-AWcqad4OIb_VKmHGs5E7PYdgvI.cache +2 -0
  90. data/test/dummy/tmp/cache/assets/sprockets/v3.0/O6/O6dw148Xya7NYlsRFMEzJyvRcySM6iOL1jRUpdQo9B8.cache +1 -0
  91. data/test/dummy/tmp/cache/assets/sprockets/v3.0/O8/O8akbUwAbmIKY-AhITimq-JDQ6IgsO3Hvq2v5etufFw.cache +2 -0
  92. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OD/ODHapE0li3WI1laVJoksoI5nmQd-8dDJXq_VxS4XefE.cache +1 -0
  93. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Oj/OjMkKTW7OkthjJAQHDID8GV30IZC9F0dJ1zGiFame9U.cache +4 -0
  94. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Os/OsQkEOfE0Pfy_sIdEIVWLojZnQm4mcrZpXg4suYrV70.cache +2 -0
  95. data/test/dummy/tmp/cache/assets/sprockets/v3.0/SU/SUtZ_ltPqy9A9A-_zqNPhNPvjxCOnrdqXHSZv5S9mOk.cache +1 -0
  96. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Tv/TvZgmm69VEMHUJQIBoij61oXMkgzp6whVo7l8mJ9qpw.cache +3 -0
  97. data/test/dummy/tmp/cache/assets/sprockets/v3.0/UA/UAOIipK_ejTAUFI6XxASoweyUiC3t64VfVzV-MfsFD8.cache +0 -0
  98. data/test/dummy/tmp/cache/assets/sprockets/v3.0/YJ/YJZdK01T1KTS84Mb6p_2TasmJNZeGZc4FMtBPCKGr_M.cache +3 -0
  99. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ah/ahhhd3ysbQmVDNzq2L_rb4t6rqqdnqeY6ujztBoZDA8.cache +1 -0
  100. data/test/dummy/tmp/cache/assets/sprockets/v3.0/dz/dzCaa80YgyvJINTgsyrVhKv9UQ1OC82GfAsA-IP96iQ.cache +0 -0
  101. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fI/fInu_Gja7ik39t207tqj4CtlL0akQRbjD2T7qEtd0zE.cache +1 -0
  102. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gv/gvZKkbgiExbcQrT4eo0HB-j4JoDRAxdmDjKRxeEdK0Y.cache +1 -0
  103. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hj/hj_r-O1QjHJIPcZVnlB_FGPdIRAi9NkxpT2oXDRIsGE.cache +1 -0
  104. data/test/dummy/tmp/cache/assets/sprockets/v3.0/jj/jjdQCKZsewws2eRP7b2AVxRMvseOp8djjlDkB8UOtac.cache +3 -0
  105. data/test/dummy/tmp/cache/assets/sprockets/v3.0/o2/o2V1ahk8vFR6sXWNh5BB7w6MBj04zCyX-o1xFZONydE.cache +1 -0
  106. data/test/dummy/tmp/cache/assets/sprockets/v3.0/o6/o6ZQbq1aBFuVrE2xLbSbyZH2736sWM3Yj4ky9chT1bI.cache +1 -0
  107. data/test/dummy/tmp/cache/assets/sprockets/v3.0/os/os0qWv3yDfep0e7vVSGTgfn_n3xc4C4QZgmMzLQn0Ks.cache +1 -0
  108. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pO/pO8hHVwybv1ZJBdPa2YC6bjqmk020OYFl85TYxtmrWQ.cache +0 -0
  109. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pj/pjJDYrBipDo6Tr9_-W4UDzfZZ4UPTy9YpXrBQFRXnlo.cache +3 -0
  110. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pw/pwiIhcWPwTuy5Miz5zqOQGYFx-K3TbaCVQ6ls7EBkk0.cache +0 -0
  111. data/test/dummy/tmp/cache/assets/sprockets/v3.0/sR/sRU-UT8qK_38kkiFDXKBPogO1oOZuSvJFH-pgqPL_Ms.cache +0 -0
  112. data/test/dummy/tmp/cache/assets/sprockets/v3.0/tE/tEO71oPPFXN_2c4p39nU0OiF9ARg13fjdQlnPqAx1KY.cache +4 -0
  113. data/test/dummy/tmp/cache/assets/sprockets/v3.0/tP/tPF6H9NRpGO3whu2y5_e_R_1EACKdCwu5437D83qJT0.cache +2 -0
  114. data/test/dummy/tmp/cache/assets/sprockets/v3.0/tW/tWFRsAv4WWu2ch-x3AJZd3KOvBXG3MwH6Q6Xn-tFBtw.cache +1 -0
  115. data/test/dummy/tmp/cache/assets/sprockets/v3.0/x6/x6W754ylumshr3wBUHHmcgyWs8UR3Od7FaI6tqvjKmk.cache +1 -0
  116. data/test/dummy/tmp/cache/assets/sprockets/v3.0/yy/yyJ1P7RQciOiW8TgQiu1RMDdbWd4rqxd2BGU9HkY3L8.cache +0 -0
  117. data/test/integration/searching_test.rb +15 -27
  118. data/test/searcher/best_bets_test.rb +13 -18
  119. data/test/test_helper.rb +23 -10
  120. data/test/vcr_cassettes/searches/best_bets_acm.yml +31 -0
  121. data/test/vcr_cassettes/searches/harry_potter.yml +6901 -0
  122. data/test/vcr_cassettes/searches/hunt_library.yml +66736 -0
  123. data/test/vcr_cassettes/searches/printing.yml +191 -0
  124. data/test/vcr_cassettes/searches/speling.yml +1172 -0
  125. metadata +197 -71
  126. data/test/controllers/search_controller_test.rb +0 -15
  127. data/test/integration/catalog_search_test.rb +0 -8
  128. data/test/integration/google_analytics_test.rb +0 -23
  129. data/test/integration/smart_subjects_test.rb +0 -8
  130. data/test/integration/website_search_test.rb +0 -8
  131. data/test/searcher/catalog_test.rb +0 -35
  132. data/test/searcher/ematrix_database_test.rb +0 -27
  133. data/test/searcher/ematrix_journal_test.rb +0 -27
  134. data/test/searcher/faq_test.rb +0 -27
  135. data/test/searcher/smart_subjects_test.rb +0 -27
  136. data/test/searcher/summon_test.rb +0 -13
  137. data/test/searcher/website_test.rb +0 -34
@@ -0,0 +1,86 @@
1
+ ---
2
+ best_bets:
3
+ academicsearchpremier:
4
+ title: Academic Search Complete
5
+ url: http://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=a9h
6
+ description: Search for full-text articles from a wide range of scholarly journals.
7
+ Formerly named Academic Search Premier.
8
+ keywords:
9
+ - academic search complete
10
+ - academic search complet
11
+ - academic search compleat
12
+ - academic search compleet
13
+ - academic search elite
14
+ - academic elite
15
+ - search elite
16
+ - academic search fulltext elite
17
+ - academic search premier
18
+ - academic premier
19
+ - academic premiere
20
+ - academic search premiere
21
+ - academic search premeir
22
+ - acedemic search premier
23
+ - academic search premire
24
+ - academic search primer
25
+ acm:
26
+ title: ACM Digital Library
27
+ url: http://www.acm.org/dl/
28
+ description: Provides access to ACM journals, magazines, and conference proceedings
29
+ keywords:
30
+ - acm
31
+ - acm digital library
32
+ - acm portal
33
+ - acm database
34
+ - acm digital
35
+ eric:
36
+ title: ERIC (Educational Resource Information Center)
37
+ url: http://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=eric
38
+ description: Use ERIC to find journal articles in the field of education
39
+ keywords:
40
+ - eric database
41
+ - eric
42
+ - education
43
+ - educational resources information center
44
+ googlescholar:
45
+ title: Google Scholar
46
+ url: http://scholar.google.com
47
+ description: Use Google Scholar and get access to articles via our library
48
+ keywords:
49
+ - google scholar
50
+ - google search
51
+ - google com
52
+ - www google com
53
+ - googlescholar
54
+ - googlescholar
55
+ - google
56
+ lexisnexis:
57
+ title: LexisNexis Academic
58
+ url: http://www.lexisnexis.com/
59
+ description: Search for news, business, legal, medical, and congressional information
60
+ keywords:
61
+ - lexis
62
+ - nexis
63
+ - lexis nexis
64
+ - lexis nexus
65
+ - lexus nexis
66
+ - lexis-nexis
67
+ - lexisnexis
68
+ - lexus
69
+ - nexus
70
+ - lexus nexus
71
+ - lexus-nexus
72
+ - lexusnexus
73
+ - lexxis nexxis
74
+ - lexxus nexus
75
+ - lexxus nexxus
76
+ - academic universe
77
+ - lexis nexis academic
78
+ - lexisnexis academic
79
+ pubmed:
80
+ title: PubMed
81
+ url: http://www.ncbi.nlm.nih.gov/
82
+ description: Search citations from MEDLINE and other medical and life science
83
+ journals
84
+ keywords:
85
+ - pubmed
86
+ - pub med
@@ -1,4 +1,5 @@
1
- QuickSearch installation complete. To add searchers:
1
+
2
+ To add/remove/replace searchers:
2
3
 
3
4
  1. Add searcher gems (see README for list of gems) to your project's Gemfile
4
5
  2. Add a theme gem to Gemfile (see README)
@@ -6,3 +7,4 @@ QuickSearch installation complete. To add searchers:
6
7
  4. Add render_module calls to search results view for each searcher
7
8
 
8
9
  For more information, see README and other documentation at http://github.com/ncsu-libraries/quick_search/
10
+
@@ -1,7 +1,29 @@
1
1
  defaults: &defaults
2
- theme: 'quick_search_generic_theme'
3
- searchers: [best_bets,arxiv,open_library,wikipedia,placeholder]
4
- found_types: [arxiv,open_library,wikipedia,placeholder,placeholder,placeholder,placeholder]
2
+
3
+ # QuickSearch theme name
4
+ #
5
+ # To use a different theme, you must first add a new theme gem to the Gemfile,
6
+ # run 'bundle install', then update this with the new theme name.
7
+ #
8
+ # See docs for more details: https://github.com/NCSU-Libraries/quick_search/blob/master/docs/configuration.md
9
+
10
+ theme: ''
11
+
12
+ # Searchers that QuickSearch will automatically search
13
+ #
14
+ # To use different searchers, you must first add the new searcher gem to the Gemfile,
15
+ # run 'bundle install', then add the searcher name to this list. You must also
16
+ # add a 'render_module()' helper call to your search results page tempate to expose the
17
+ # results for that searcher.
18
+ #
19
+ # See docs for more details: https://github.com/NCSU-Libraries/quick_search/blob/master/docs/configuration.md
20
+
21
+ searchers: [best_bets]
22
+
23
+ # Searchers listed in the "result type guide" bar that lists result types that were found for a given search
24
+
25
+ found_types: []
26
+
5
27
  per_page: 3
6
28
  max_per_page: 50
7
29
  http_timeout: 1.5
data/lib/quick_search.rb CHANGED
@@ -4,8 +4,6 @@ require "httpclient"
4
4
  require "kaminari"
5
5
  require "nokogiri"
6
6
  require "mysql2"
7
- require "rsolr"
8
- require "exception_notification"
9
7
 
10
8
  module QuickSearch
11
9
  end
@@ -5,12 +5,27 @@ module QuickSearch
5
5
  initializer :quick_search, :after => :add_view_paths do
6
6
  config_file = File.join(Rails.root, "/config/quick_search_config.yml")
7
7
  if File.exist?(config_file)
8
- APP_CONFIG = YAML.load_file(config_file)[Rails.env]
8
+ QuickSearch::Engine::APP_CONFIG = YAML.load_file(config_file)[Rails.env]
9
9
  ActiveSupport.on_load(:action_controller) do
10
10
  theme_engine_class = "#{QuickSearch::Engine::APP_CONFIG['theme'].classify}::Engine".constantize
11
11
  prepend_view_path theme_engine_class.root.join('app', 'views', QuickSearch::Engine::APP_CONFIG['theme'])
12
12
  end
13
13
  end
14
14
  end
15
+
16
+ initializer :best_bets, :after => :quick_search do
17
+ if defined? QuickSearch::Engine::APP_CONFIG and QuickSearch::Engine::APP_CONFIG['best_bets']['solr_url'].empty?
18
+ best_bets_file = File.join(Rails.root, "/config/best_bets.yml")
19
+ if File.exist?(best_bets_file)
20
+ QuickSearch::Engine::BEST_BETS = YAML.load_file(best_bets_file)['best_bets']
21
+ QuickSearch::Engine::BEST_BETS_INDEX = {}
22
+ QuickSearch::Engine::BEST_BETS.each do |best_bet_name, best_bet|
23
+ best_bet['keywords'].each do |keyword|
24
+ QuickSearch::Engine::BEST_BETS_INDEX[keyword.downcase] = best_bet_name
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
15
30
  end
16
31
  end
@@ -1,3 +1,3 @@
1
1
  module QuickSearch
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,6 +1,8 @@
1
1
  namespace :best_bets do
2
2
  desc 'Update the BestBets SOLR index from best_bets.yml'
3
3
  task :update_index => :environment do
4
+ require 'rsolr'
5
+
4
6
  best_bets_yaml = File.join Rails.root, "/config/best_bets.yml"
5
7
  best_bets = YAML.load_file(best_bets_yaml)['best_bets']
6
8
 
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class DoiTrapTest < ActionController::TestCase
4
4
 
5
- include DoiTrap
5
+ include QuickSearch::DoiTrap
6
6
 
7
7
  test "should be a doi" do
8
8
  doi = '10.1016/0046-8177(95)90302-X'
@@ -13,7 +13,7 @@ class DoiTrapTest < ActionController::TestCase
13
13
  test "should not be a doi" do
14
14
  doi = '0046-8177(95)90302-X'
15
15
  is_a_doi = is_a_doi?(doi)
16
- assert_not is_a_doi
16
+ assert_not is_a_doi
17
17
  end
18
18
 
19
- end
19
+ end
@@ -2,10 +2,10 @@ require 'test_helper'
2
2
 
3
3
  class OnCampusTest < ActionController::TestCase
4
4
 
5
- include OnCampus
5
+ include QuickSearch::OnCampus
6
6
 
7
7
  test "should be on campus" do
8
- ip = '152.14.1.1'
8
+ ip = '192.168.1.100'
9
9
  on_campus = on_campus?(ip)
10
10
  assert on_campus
11
11
  end
@@ -13,7 +13,7 @@ class OnCampusTest < ActionController::TestCase
13
13
  test "should not be on campus" do
14
14
  ip = '152.2.1.1'
15
15
  on_campus = on_campus?(ip)
16
- assert_not on_campus
16
+ assert_not on_campus
17
17
  end
18
18
 
19
- end
19
+ end
@@ -2,11 +2,11 @@ require 'test_helper'
2
2
 
3
3
  class QueryParserTest < ActionController::TestCase
4
4
 
5
- include QueryParser
5
+ include QuickSearch::QueryParser
6
6
 
7
7
  test "should extract basic prefixed scoped query" do
8
8
  full_query = 'scope:scrc libraries'
9
-
9
+
10
10
  query = extracted_query(full_query)
11
11
  assert_equal('libraries', query)
12
12
 
@@ -16,7 +16,7 @@ class QueryParserTest < ActionController::TestCase
16
16
 
17
17
  test "should extract basic suffixed scoped query" do
18
18
  full_query = 'libraries scope:scrc'
19
-
19
+
20
20
  query = extracted_query(full_query)
21
21
  assert_equal('libraries', query)
22
22
 
@@ -26,7 +26,7 @@ class QueryParserTest < ActionController::TestCase
26
26
 
27
27
  test "should extract compound prefixed scoped query" do
28
28
  full_query = 'scope:(scrc OR jobs) libraries'
29
-
29
+
30
30
  query = extracted_query(full_query)
31
31
  assert_equal('libraries', query)
32
32
 
@@ -36,7 +36,7 @@ class QueryParserTest < ActionController::TestCase
36
36
 
37
37
  test "should extract compound suffixed scoped query" do
38
38
  full_query = 'libraries scope:(scrc OR jobs)'
39
-
39
+
40
40
  query = extracted_query(full_query)
41
41
  assert_equal('libraries', query)
42
42
 
@@ -44,4 +44,4 @@ class QueryParserTest < ActionController::TestCase
44
44
  assert_equal('scrc OR jobs', scope)
45
45
  end
46
46
 
47
- end
47
+ end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class AppstatsControllerTest < ActionController::TestCase
3
+ class QuickSearch::AppstatsControllerTest < ActionController::TestCase
4
4
  # test "the truth" do
5
5
  # assert true
6
6
  # end
@@ -1,6 +1,11 @@
1
1
  require 'test_helper'
2
2
 
3
- class OpensearchControllerTest < ActionController::TestCase
3
+ class QuickSearch::OpensearchControllerTest < ActionController::TestCase
4
+ include QuickSearch::Engine.routes.url_helpers
5
+
6
+ setup do
7
+ @routes = QuickSearch::Engine.routes
8
+ end
4
9
 
5
10
  test "should return xml" do
6
11
  @request.env['HTTP_ACCEPT'] = 'application/xml'
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class PagesControllerTest < ActionController::TestCase
3
+ class QuickSearch::PagesControllerTest < ActionController::TestCase
4
4
  # test "the truth" do
5
5
  # assert true
6
6
  # end
@@ -0,0 +1,15 @@
1
+ require 'test_helper'
2
+
3
+ class QuickSearch::SearchControllerTest < ActionController::TestCase
4
+
5
+ # vcr_test "should return a summon searcher" do
6
+ # get :index, q: 'printing'
7
+ # assert assigns(:summon)
8
+ # end
9
+
10
+ test "should redirect to link resolver" do
11
+ get :index, params: { q: 'doi:10.1002/0470841559.ch1' }
12
+ assert_redirected_to 'http://doi.org/10.1002%2F0470841559.ch1'
13
+ end
14
+
15
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application