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
@@ -1,35 +0,0 @@
1
- require 'test_helper'
2
-
3
- class CatalogSearcherTest < ActiveSupport::TestCase
4
-
5
- setup do
6
- @catalog = QuickSearch::CatalogSearcher.new(HTTPClient.new, 'printing', 3)
7
- end
8
-
9
- test "should have http client, query, and per_page" do
10
- assert @catalog.http.is_a? HTTPClient
11
- assert @catalog.q == 'printing'
12
- assert_equal 3, @catalog.per_page
13
- end
14
-
15
- vcr_test "should have raw result", 'searches', cassette: 'catalog_printing' do
16
- raw_results = @catalog.search
17
- assert raw_results.children.first.name == 'searchResponse'
18
- #assert raw_results['searchResponse']
19
- end
20
-
21
- vcr_test "should have parsed results", 'searches', cassette: 'catalog_printing' do
22
- @catalog.search
23
- parsed_results = @catalog.results
24
- assert parsed_results.first.title.include?('Federal printing : overview and selected issues')
25
- end
26
-
27
- # # FIXME: this test should be moved to a result set object
28
- # vcr_test "should have raw search results", "searches", cassette: 'printing' do
29
- # summon = QuickSearch::SummonSearcher.new(HTTPClient.new, 'printing', 3)
30
- # summon.search
31
- # results = summon.results
32
- # assert results.first.description.include?('Although we live in the digital age')
33
- # end
34
-
35
- end
@@ -1,27 +0,0 @@
1
- require 'test_helper'
2
-
3
- class EmatrixDatabaseSearcherTest < ActiveSupport::TestCase
4
-
5
- setup do
6
- @database = QuickSearch::EmatrixDatabaseSearcher.new(HTTPClient.new, 'chemistry', 3)
7
- end
8
-
9
- test "should have http client, query, and per_page" do
10
- assert @database.http.is_a? HTTPClient
11
- assert @database.q == 'chemistry'
12
- assert_equal 3, @database.per_page
13
- end
14
-
15
- vcr_test "should have raw result", 'searches', cassette: 'ematrix_database_chemistry' do
16
- raw_results = @database.search
17
- assert raw_results.is_a?(Nokogiri::XML::Document)
18
- end
19
-
20
- vcr_test "should have parsed results", 'searches', cassette: 'ematrix_database_chemistry' do
21
- @database.search
22
- parsed_results = @database.results
23
- assert parsed_results.first.title.include?('Encyclopedia of analytical chemistry')
24
- assert parsed_results.first.link.include?('proxying.lib.ncsu.edu')
25
- end
26
-
27
- end
@@ -1,27 +0,0 @@
1
- require 'test_helper'
2
-
3
- class EmatrixJournalSearcherTest < ActiveSupport::TestCase
4
-
5
- setup do
6
- @journal = QuickSearch::EmatrixJournalSearcher.new(HTTPClient.new, 'chemistry', 3)
7
- end
8
-
9
- test "should have http client, query, and per_page" do
10
- assert @journal.http.is_a? HTTPClient
11
- assert @journal.q == 'chemistry'
12
- assert_equal 3, @journal.per_page
13
- end
14
-
15
- vcr_test "should have raw result", 'searches', cassette: 'ematrix_journal_chemistry' do
16
- raw_results = @journal.search
17
- assert raw_results.is_a?(Nokogiri::XML::Document)
18
- end
19
-
20
- vcr_test "should have parsed results", 'searches', cassette: 'ematrix_journal_chemistry' do
21
- @journal.search
22
- parsed_results = @journal.results
23
- assert parsed_results.first.title.include?('Annual reports')
24
- assert parsed_results.first.link.include?('33000')
25
- end
26
-
27
- end
@@ -1,27 +0,0 @@
1
- require 'test_helper'
2
-
3
- class FaqSearcherTest < ActiveSupport::TestCase
4
-
5
- setup do
6
- @faq = QuickSearch::FaqSearcher.new(HTTPClient.new, 'printing', 3)
7
- end
8
-
9
- test "should have http client, query, and per_page" do
10
- assert @faq.http.is_a? HTTPClient
11
- assert @faq.q == 'printing'
12
- assert_equal 3, @faq.per_page
13
- end
14
-
15
- # vcr_test "should have raw result", 'searches', cassette: 'faq_printing' do
16
- # raw_results = @faq.search
17
- # assert raw_results.is_a?(Sequel::MySQL::Dataset)
18
- # end
19
-
20
- # vcr_test "should have parsed results", 'searches', cassette: 'faq_printing' do
21
- # @faq.search
22
- # parsed_results = @faq.results
23
- # assert parsed_results.first.title.include?('Print Quota')
24
- # assert parsed_results.first.link.include?('274')
25
- # end
26
-
27
- end
@@ -1,27 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SmartSubjectsSearcherTest < ActiveSupport::TestCase
4
-
5
- setup do
6
- @subjects = QuickSearch::SmartSubjectsSearcher.new(HTTPClient.new, 'chemistry', 3)
7
- end
8
-
9
- test "should have http client, query, and per_page" do
10
- assert @subjects.http.is_a? HTTPClient
11
- assert @subjects.q == 'chemistry'
12
- assert_equal 3, @subjects.per_page
13
- end
14
-
15
- vcr_test "should have raw result", 'searches', cassette: 'smart_subjects_chemistry' do
16
- raw_results = @subjects.search
17
- assert raw_results['responseHeader']
18
- end
19
-
20
- vcr_test "should have parsed results", 'searches', cassette: 'smart_subjects_chemistry' do
21
- @subjects.search
22
- parsed_results = @subjects.results
23
- assert parsed_results.first.title.include?('Biochemistry')
24
- assert parsed_results.first.link.include?('subject=13')
25
- end
26
-
27
- end
@@ -1,13 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SummonSearcherTest < ActiveSupport::TestCase
4
-
5
- # FIXME: this test should be moved to a result set object
6
- vcr_test "should have author in result", "searches", cassette: 'printing' do
7
- summon = QuickSearch::SummonSearcher.new(HTTPClient.new, 'printing', 3)
8
- summon.search
9
- results = summon.results
10
- assert results.first.description.include?('Although we live in the digital age')
11
- end
12
-
13
- end
@@ -1,34 +0,0 @@
1
- require 'test_helper'
2
-
3
- class WebsiteSearcherTest < ActiveSupport::TestCase
4
-
5
- setup do
6
- @website = QuickSearch::WebsiteSearcher.new(HTTPClient.new, 'printing', 3)
7
- end
8
-
9
- test "should have http client, query, and per_page" do
10
- assert @website.http.is_a? HTTPClient
11
- assert @website.q == 'printing'
12
- assert_equal 3, @website.per_page
13
- end
14
-
15
- vcr_test "should have raw result", 'searches', cassette: 'website_printing' do
16
- raw_results = @website.search
17
- assert raw_results['responseHeader']
18
- end
19
-
20
- vcr_test "should have parsed results", 'searches', cassette: 'website_printing' do
21
- @website.search
22
- parsed_results = @website.results
23
- assert parsed_results.first.title.include?('Print')
24
- end
25
-
26
- # # FIXME: this test should be moved to a result set object
27
- # vcr_test "should have raw search results", "searches", cassette: 'printing' do
28
- # summon = QuickSearch::SummonSearcher.new(HTTPClient.new, 'printing', 3)
29
- # summon.search
30
- # results = summon.results
31
- # assert results.first.description.include?('Although we live in the digital age')
32
- # end
33
-
34
- end