quick_search-core 0.0.1.test

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +168 -0
  4. data/Rakefile +6 -0
  5. data/app/assets/images/quick_search/askus.gif +0 -0
  6. data/app/assets/images/quick_search/favicon.ico +0 -0
  7. data/app/assets/images/quick_search/greybox.png +0 -0
  8. data/app/assets/images/quick_search/homescreen-icon-64x64.png +0 -0
  9. data/app/assets/images/quick_search/ncsu-library-logo-white.png +0 -0
  10. data/app/assets/javascripts/quick_search/appstats.js +8 -0
  11. data/app/assets/javascripts/quick_search/event_tracking.js.erb +257 -0
  12. data/app/assets/javascripts/quick_search/google_analytics.js.erb +8 -0
  13. data/app/assets/javascripts/quick_search/opensearch.js +2 -0
  14. data/app/assets/javascripts/quick_search/pages.js.coffee +3 -0
  15. data/app/assets/javascripts/quick_search/quicksearch.js +33 -0
  16. data/app/assets/javascripts/quick_search/realtime.js.erb +12 -0
  17. data/app/assets/javascripts/quick_search/search.js +3 -0
  18. data/app/assets/javascripts/quick_search/xhr_search.js +82 -0
  19. data/app/assets/javascripts/quick_search.js.erb +20 -0
  20. data/app/assets/stylesheets/foundation_and_overrides.scss +1327 -0
  21. data/app/assets/stylesheets/quick_search/appstats.css.scss +7 -0
  22. data/app/assets/stylesheets/quick_search/opensearch.css.scss +3 -0
  23. data/app/assets/stylesheets/quick_search/pages.css.scss +3 -0
  24. data/app/assets/stylesheets/quick_search/quick_search.css.scss +248 -0
  25. data/app/assets/stylesheets/quick_search/search.css.scss +3 -0
  26. data/app/assets/stylesheets/quick_search.css.scss.erb +7 -0
  27. data/app/controllers/concerns/quick_search/auth.rb +22 -0
  28. data/app/controllers/concerns/quick_search/doi_trap.rb +43 -0
  29. data/app/controllers/concerns/quick_search/encode_utf8.rb +12 -0
  30. data/app/controllers/concerns/quick_search/on_campus.rb +43 -0
  31. data/app/controllers/concerns/quick_search/query_filter.rb +25 -0
  32. data/app/controllers/concerns/quick_search/query_parser.rb +54 -0
  33. data/app/controllers/concerns/quick_search/searcher_concern.rb +101 -0
  34. data/app/controllers/concerns/quick_search/searcher_config.rb +16 -0
  35. data/app/controllers/quick_search/application_controller.rb +7 -0
  36. data/app/controllers/quick_search/appstats_controller.rb +210 -0
  37. data/app/controllers/quick_search/opensearch_controller.rb +9 -0
  38. data/app/controllers/quick_search/pages_controller.rb +18 -0
  39. data/app/controllers/quick_search/search_controller.rb +250 -0
  40. data/app/helpers/quick_search/application_helper.rb +68 -0
  41. data/app/helpers/quick_search/appstats_helper.rb +2 -0
  42. data/app/helpers/quick_search/opensearch_helper.rb +2 -0
  43. data/app/helpers/quick_search/pages_helper.rb +2 -0
  44. data/app/helpers/quick_search/search_helper.rb +2 -0
  45. data/app/models/event.rb +2 -0
  46. data/app/models/search.rb +11 -0
  47. data/app/searchers/quick_search/best_bets_searcher.rb +102 -0
  48. data/app/searchers/quick_search/searcher.rb +43 -0
  49. data/app/views/layouts/quick_search/_best_bets.html.erb +18 -0
  50. data/app/views/layouts/quick_search/_common_searches.html.erb +15 -0
  51. data/app/views/layouts/quick_search/_found_types.html.erb +13 -0
  52. data/app/views/layouts/quick_search/_google_analytics.html.erb +24 -0
  53. data/app/views/layouts/quick_search/_more_options.html.erb +10 -0
  54. data/app/views/layouts/quick_search/_page_title.html.erb +8 -0
  55. data/app/views/layouts/quick_search/_related_topics.html.erb +8 -0
  56. data/app/views/layouts/quick_search/_search_form.html.erb +19 -0
  57. data/app/views/layouts/quick_search/_spelling_suggestion.html.erb +13 -0
  58. data/app/views/layouts/quick_search/_topic_snippet.html.erb +5 -0
  59. data/app/views/layouts/quick_search/application.html.erb +40 -0
  60. data/app/views/quick_search/appstats/_click_count_table.html.erb +23 -0
  61. data/app/views/quick_search/appstats/_datatables.html.erb +12 -0
  62. data/app/views/quick_search/appstats/_date_range.html.erb +15 -0
  63. data/app/views/quick_search/appstats/_menu.html.erb +16 -0
  64. data/app/views/quick_search/appstats/_top_spot_report_table.html.erb +33 -0
  65. data/app/views/quick_search/appstats/clicks_overview.html.erb +20 -0
  66. data/app/views/quick_search/appstats/index.html.erb +31 -0
  67. data/app/views/quick_search/appstats/module_click_detail.html.erb +32 -0
  68. data/app/views/quick_search/appstats/realtime.html.erb +15 -0
  69. data/app/views/quick_search/appstats/top_searches.html.erb +38 -0
  70. data/app/views/quick_search/appstats/top_spot.html.erb +14 -0
  71. data/app/views/quick_search/appstats/top_spot_detail.html.erb +35 -0
  72. data/app/views/quick_search/kaminari/_first_page.html.erb +12 -0
  73. data/app/views/quick_search/kaminari/_gap.html.erb +11 -0
  74. data/app/views/quick_search/kaminari/_last_page.html.erb +12 -0
  75. data/app/views/quick_search/kaminari/_next_page.html.erb +12 -0
  76. data/app/views/quick_search/kaminari/_page.html.erb +13 -0
  77. data/app/views/quick_search/kaminari/_paginator.html.erb +25 -0
  78. data/app/views/quick_search/kaminari/_prev_page.html.erb +11 -0
  79. data/app/views/quick_search/opensearch/opensearch.xml.builder +11 -0
  80. data/app/views/quick_search/pages/about.html.erb +9 -0
  81. data/app/views/quick_search/pages/home.html.erb +6 -0
  82. data/app/views/quick_search/pages/realtime.html.erb +15 -0
  83. data/app/views/quick_search/search/_citation.html.erb +18 -0
  84. data/app/views/quick_search/search/_module.html.erb +37 -0
  85. data/app/views/quick_search/search/_module_with_paging.html.erb +14 -0
  86. data/app/views/quick_search/search/_no_results.html.erb +11 -0
  87. data/app/views/quick_search/search/_result.html.erb +17 -0
  88. data/app/views/quick_search/search/_result_details.html.erb +45 -0
  89. data/app/views/quick_search/search/_result_no_thumbnail.html.erb +3 -0
  90. data/app/views/quick_search/search/_result_title.html.erb +4 -0
  91. data/app/views/quick_search/search/_result_with_thumbnail.html.erb +21 -0
  92. data/app/views/quick_search/search/_search_error.html.erb +9 -0
  93. data/app/views/quick_search/search/_see_all.html.erb +11 -0
  94. data/app/views/quick_search/search/_xhr_response.html.erb +15 -0
  95. data/app/views/quick_search/search/_xhr_response.json.erb +14 -0
  96. data/app/views/quick_search/search/_xhr_response_with_paging.html.erb +1 -0
  97. data/app/views/quick_search/search/index.html.erb +100 -0
  98. data/config/application.rb +25 -0
  99. data/config/best_bets.yml +86 -0
  100. data/config/boot.rb +4 -0
  101. data/config/database.yml.example +31 -0
  102. data/config/locales/en.yml +30 -0
  103. data/config/quicksearch_config.yml.example +69 -0
  104. data/config/routes.rb +81 -0
  105. data/db/migrate/20140130202859_create_events.rb +11 -0
  106. data/db/migrate/20140130202944_create_searches.rb +9 -0
  107. data/db/migrate/20140225145441_add_page_to_searches.rb +5 -0
  108. data/db/schema.rb +31 -0
  109. data/db/seeds.rb +7 -0
  110. data/lib/benchmark_logger.rb +2 -0
  111. data/lib/capistrano/tasks/access_check.cap +10 -0
  112. data/lib/generators/quick_search/install_generator.rb +49 -0
  113. data/lib/generators/quick_search/templates/kaminari.rb +5 -0
  114. data/lib/generators/quick_search/templates/post_install.txt +8 -0
  115. data/lib/generators/quick_search/templates/quick_search_config.yml +58 -0
  116. data/lib/quick_search/engine.rb +16 -0
  117. data/lib/quick_search/version.rb +3 -0
  118. data/lib/quick_search.rb +12 -0
  119. data/lib/tasks/best_bets.rake +29 -0
  120. data/test/controllers/appstats_controller_test.rb +7 -0
  121. data/test/controllers/concerns/doi_trap_test.rb +19 -0
  122. data/test/controllers/concerns/on_campus_test.rb +19 -0
  123. data/test/controllers/concerns/query_parser_test.rb +47 -0
  124. data/test/controllers/opensearch_controller_test.rb +13 -0
  125. data/test/controllers/pages_controller_test.rb +7 -0
  126. data/test/controllers/search_controller_test.rb +15 -0
  127. data/test/fixtures/events.yml +11 -0
  128. data/test/fixtures/searches.yml +7 -0
  129. data/test/helpers/appstats_helper_test.rb +4 -0
  130. data/test/helpers/opensearch_helper_test.rb +4 -0
  131. data/test/helpers/pages_helper_test.rb +4 -0
  132. data/test/helpers/search_helper_test.rb +4 -0
  133. data/test/integration/catalog_search_test.rb +8 -0
  134. data/test/integration/google_analytics_test.rb +23 -0
  135. data/test/integration/landing_page_test.rb +8 -0
  136. data/test/integration/searching_test.rb +40 -0
  137. data/test/integration/smart_subjects_test.rb +8 -0
  138. data/test/integration/website_search_test.rb +8 -0
  139. data/test/models/event_test.rb +7 -0
  140. data/test/models/search_test.rb +7 -0
  141. data/test/searcher/best_bets_test.rb +35 -0
  142. data/test/searcher/catalog_test.rb +35 -0
  143. data/test/searcher/ematrix_database_test.rb +27 -0
  144. data/test/searcher/ematrix_journal_test.rb +27 -0
  145. data/test/searcher/faq_test.rb +27 -0
  146. data/test/searcher/smart_subjects_test.rb +27 -0
  147. data/test/searcher/summon_test.rb +13 -0
  148. data/test/searcher/website_test.rb +34 -0
  149. data/test/support/vcr_test.rb +40 -0
  150. data/test/test_helper.rb +42 -0
  151. metadata +366 -0
@@ -0,0 +1,11 @@
1
+ xml.instruct!
2
+ xml.OpenSearchDescription(:xmlns => 'http://a9.com/-/spec/opensearch/1.1/', 'xmlns:moz' => 'http://www.mozilla.org/2006/browser/search/') do
3
+ xml.ShortName(t(:default_title))
4
+ xml.InputEncoding('UTF-8')
5
+ xml.Image("#{asset_url 'homescreen-icon-64x64.png'}", :height => '64', :width =>'64', :type =>'image/png')
6
+ xml.Image("#{asset_url 'favicon.ico'}", :height => '16', :width =>'16', :type => 'image/x-icon')
7
+ xml.Description(t(:opensearch_description))
8
+ xml.Contact(t(:contact_email))
9
+ xml.Url(type: 'text/html', method: 'get', template: root_url + '?q={searchTerms}' )
10
+ xml.moz(:SearchForm, root_url)
11
+ end
@@ -0,0 +1,9 @@
1
+ <% title %>
2
+ <div class="row">
3
+ <div class="small-12 columns">
4
+ <h1>About QuickSearch</h1>
5
+ <p>QuickSearch, developed by NCSU Libraries, is a customized federated search tool designed to connect people to a variety of library resources, services, and tools. QuickSearch is designed to complement and increase use of existing dedicated library resource discovery tools, such as the catalog, electronic resource search, and subject guides/portals, by directing people to them via an intuitive search interface. The aim of QuickSearch is to provide people with a quick and easy way to find the information they need.</p>
6
+ <p>See the <a href="http://www.lib.ncsu.edu/dli/projects/quicksearch/">QuickSearch Project</a> for technical details.</p>
7
+ <p>To provide feedback or to report a problem, please email the QuickSearch product team at <a href="mailto:quicksearch@lists.ncsu.edu">quicksearch@lists.ncsu.edu</a>.</p>
8
+ </div>
9
+ </div>
@@ -0,0 +1,6 @@
1
+ <% title %>
2
+ <%= render partial: '/layouts/quick_search/page_title', locals: { page_title: @page_title } %>
3
+ <%= render partial: 'layouts/quick_search/search_form' %>
4
+ <div class="quicksearch-ga-click-tracking">
5
+ <%= render partial: 'layouts/quick_search/common_searches' %>
6
+ </div>
@@ -0,0 +1,15 @@
1
+ <% title %>
2
+ <div class="row">
3
+ <div class="small-12 columns">
4
+ <h1>Realtime Searches</h1>
5
+ <p>What you see below is a stream of searches as they happen in real time.</p>
6
+ <div id="realtime_searches">
7
+ <ul class="disc">
8
+
9
+ </ul>
10
+ </div>
11
+ </div>
12
+ </div>
13
+
14
+ <%= javascript_include_tag File.join(QuickSearch::Engine::APP_CONFIG['realtime_url'], '/socket.io/socket.io.js') %>
15
+ <%= javascript_include_tag 'realtime' %>
@@ -0,0 +1,18 @@
1
+ <% if result.publisher %>
2
+ <span class="publisher citation">
3
+ <%= result.publisher %><%= result.volume || result.issue || result.pages ? ', ' : '.' %>
4
+ </span>
5
+ <% end %>
6
+ <% if result.volume %>
7
+ <span class="volume citation">
8
+ <%= t 'citation_labels.volume' %>&nbsp;<%= result.volume %><%= result.issue || result.pages ? ', ' : '.' %>
9
+ </span>
10
+ <% end %>
11
+ <% if result.issue %>
12
+ <span class="issue citation">
13
+ <%= t 'citation_labels.issue' %>&nbsp;<%= result.issue %><%= result.pages ? ', ' : '.' %>
14
+ </span>
15
+ <% end %>
16
+ <% if result.pages %>
17
+ <span class="pages citation"><%= pages(result.pages).html_safe %>.</span>
18
+ <% end %>
@@ -0,0 +1,37 @@
1
+ <div id="<%= service_name.dasherize %>" class="module-contents" >
2
+ <% if searcher.is_a? StandardError %>
3
+ <h2 class="result-set-heading"><%= module_display_name %></h2>
4
+ <% if params[:page].blank? %>
5
+ <% page = 1 %>
6
+ <% else %>
7
+ <% page = params[:page] %>
8
+ <% end %>
9
+ <%= render partial: '/quick_search/search/search_error', locals: { service_name: service_name, page: page, template: 'without_paging' } %>
10
+ <% elsif searcher.results.blank? %>
11
+ <h2 class="result-set-heading"><%= module_display_name %></h2>
12
+ <%= render partial: '/quick_search/search/no_results', locals: {module_display_name: module_display_name, service_name: service_name} %>
13
+ <% else %>
14
+ <% total = number_with_delimiter(searcher.total) %>
15
+ <% unless defined? searcher.loaded_link_mobile %>
16
+ <h2><%= link_to raw(module_display_name), searcher.loaded_link, { :class => 'result-set-heading'} %></h2>
17
+ <% else %>
18
+ <h2 class='show-for-medium-up'><%= link_to raw(module_display_name), searcher.loaded_link, { :class => 'result-set-heading'} %></h2>
19
+ <h2 class='show-for-small-only'><%= link_to raw(module_display_name), searcher.loaded_link_mobile, { :class => 'result-set-heading'} %></h2>
20
+ <% end %>
21
+ <ol>
22
+ <%= render partial: '/quick_search/search/result', collection: searcher.results %>
23
+ </ol>
24
+ <p class="see-all-results">
25
+ <% unless defined? searcher.loaded_link_mobile %>
26
+ <%= render partial: '/quick_search/search/see_all', locals: {service_name: service_name, total: total, module_link: searcher.loaded_link} %>
27
+ <% else %>
28
+ <span class="show-for-medium-up">
29
+ <%= render partial: '/quick_search/search/see_all', locals: {service_name: service_name, total: total, module_link: searcher.loaded_link} %>
30
+ </span>
31
+ <span class="show-for-small-only">
32
+ <%= render partial: '/quick_search/search/see_all', locals: {service_name: service_name, total: total, module_link: searcher.loaded_link_mobile} %>
33
+ </span>
34
+ <% end %>
35
+ </p>
36
+ <% end %>
37
+ </div>
@@ -0,0 +1,14 @@
1
+ <div id="<%= service_name.dasherize %>" class="module-contents">
2
+ <% if searcher.is_a? StandardError %>
3
+ <%= render partial: '/quick_search/search/search_error', locals: { service_name: service_name, page: page, template: 'with_paging' } %>
4
+ <% elsif searcher.results.blank? %>
5
+ <%= render partial: '/quick_search/search/no_results', locals: { :service_name => service_name } %>
6
+ <% else %>
7
+ <% total = number_with_delimiter(searcher.total) %>
8
+ <p>Page <%= page %> of <%= total %> <%= t("#{service_name}_search.short_display_name") %> results</p>
9
+ <ol>
10
+ <%= render partial: '/quick_search/search/result', collection: searcher.results %>
11
+ </ol>
12
+ <%= paginate searcher.paging, :params => { :controller => 'search', :action => 'single_searcher', :searcher_name => service_name, :endpoint => nil, :template => nil, :format => nil }, :views_prefix => 'quick_search' %>
13
+ <% end %>
14
+ </div>
@@ -0,0 +1,11 @@
1
+ <p class='search-error-message'><i class="fa fa-info-circle"></i> No <%= t("#{service_name}_search.short_display_name") %> results found for <span class="query"><%= display_query %></span></p>
2
+ <p class="see-all-results show-for-medium-up">
3
+ <%= link_to t("#{service_name}_search.no_results_link"), data: {"quicksearch_ga_action" => "no-results"} do %>
4
+ <i class="fa fa-angle-right"></i> Try <%= t("#{service_name}_search.no_results_service_message") %>
5
+ <% end %>
6
+ </p>
7
+ <p class="see-all-results show-for-small-only">
8
+ <%= link_to t("#{service_name}_search.no_results_link_mobile", :default => t("#{service_name}_search.no_results_link")), data: {"quicksearch_ga_action" => "no-results"} do %>
9
+ <i class="fa fa-angle-right"></i> Try <%= t("#{service_name}_search.no_results_service_message") %>
10
+ <% end %>
11
+ </p>
@@ -0,0 +1,17 @@
1
+ <% if result["link"].instance_of?(String) %>
2
+ <% unless result["link"].blank? or (result["link"].blank? and result["title"].blank?) %>
3
+ <% if result["thumbnail"] %>
4
+ <li class='with-thumbnail'>
5
+ <div class="row result">
6
+ <%= render partial: '/quick_search/search/result_with_thumbnail', locals: { result: result } %>
7
+ </div>
8
+ </li>
9
+ <% else %>
10
+ <li class='no-thumbnail'>
11
+ <div class="row result">
12
+ <%= render partial: '/quick_search/search/result_no_thumbnail', locals: { result: result } %>
13
+ </div>
14
+ </li>
15
+ <% end %>
16
+ <% end %>
17
+ <% end %>
@@ -0,0 +1,45 @@
1
+ <% unless result["mobile_link"] %>
2
+ <h3 class='title'>
3
+ <%= render partial: "/quick_search/search/result_title", locals: { link: result['link'], title: result['title'], date: result['date'] } %>
4
+ </h3>
5
+ <% else %>
6
+ <h3 class='title show-for-medium-up'>
7
+ <%= render partial: "/quick_search/search/result_title", locals: { link: result['link'], title: result['title'], date: result['date'] } %>
8
+ </h3>
9
+ <h3 class='title show-for-small-only'>
10
+ <%= render partial: "/quick_search/search/result_title", locals: { link: result['mobile_link'], title: result['title'], date: result['date'] } %>
11
+ </h3>
12
+ <% end %>
13
+ <p class='link'><%= result["link"] %></p>
14
+ <% if result.description %>
15
+ <p class='description'><%= result["description"].html_safe %></p>
16
+ <% end %>
17
+ <% if result["author"]%>
18
+ <% author = result["author"].html_safe %>
19
+ <% end %>
20
+ <p class='author'><%= truncate(author, length: 80, separator: '; ') %></p>
21
+ <% if result.citation %>
22
+ <p class="citation">
23
+ <%= render partial: '/quick_search/search/citation', locals: {:result => result} %>
24
+ </p>
25
+ <% end %>
26
+ <p class='format'><%= result["format"] %>
27
+
28
+ <% if result['fulltext'] %>
29
+ <%= link_to result["link"], {:class => ''} do %>
30
+ Full&nbsp;Text&nbsp;Online&nbsp;<i class='fa fa-cloud-download'></i>
31
+ <% end %>
32
+ <% end %>
33
+ </p>
34
+ <p>
35
+ <% if result['availability'] %>
36
+ <% if result["availability"] == "Available" %>
37
+ <span class='availability available' title='Available'><i class='fa fa-check'></i></span>
38
+ <% else %>
39
+ <span class='availability unavailable' title='Not Available'><i class='fa fa-times'></i></span>
40
+ <% end %>
41
+ <% end %>
42
+ <% if result['location'] %>
43
+ <span class='location'><%= result['location'] %></span>
44
+ <% end %>
45
+ </p>
@@ -0,0 +1,3 @@
1
+ <div class="small-12 columns">
2
+ <%= render partial: '/quick_search/search/result_details', locals: { result: result } %>
3
+ </div>
@@ -0,0 +1,4 @@
1
+ <%= link_to link do %>
2
+ <%= truncate(strip_tags(title.html_safe), :length => 100, separator: ' ') %>
3
+ <% end %>
4
+ <span class='date'><%= date %></span>
@@ -0,0 +1,21 @@
1
+ <div class="small-9 columns">
2
+ <%= render partial: '/quick_search/search/result_details', locals: { result: result } %>
3
+ </div>
4
+ <% unless result["mobile_link"] %>
5
+ <div class="small-3 columns">
6
+ <%= link_to result.link do %>
7
+ <%= image_tag result["thumbnail"], :class => 'thumbnail' %>
8
+ <% end %>
9
+ </div>
10
+ <% else %>
11
+ <div class="small-3 columns show-for-medium-up">
12
+ <%= link_to result.link do %>
13
+ <%= image_tag result["thumbnail"], :class => 'thumbnail' %>
14
+ <% end %>
15
+ </div>
16
+ <div class="small-3 columns show-for-small-only">
17
+ <%= link_to result.mobile_link do %>
18
+ <%= image_tag result["thumbnail"], :class => 'thumbnail' %>
19
+ <% end %>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <p class="search-error" data-quicksearch-search-endpoint="<%= service_name %>"
2
+ data-quicksearch-page="<%= page %>"
3
+ data-quicksearch-template="<%= template %>"></p>
4
+ <p class="search-error-rescue search-error-message"><i class="fa fa-warning"></i> We're sorry. This search took too long.</p>
5
+ <p class="search-error-rescue see-all-results">
6
+ <%= link_to t("#{service_name}_search.loaded_link") + url_encode("#{@query}"), data: {"quicksearch_ga_action" => "error"} do %>
7
+ <i class="fa fa-angle-right"></i> Try <%= t("#{service_name}_search.error_service_message") %> for <span class='query'>"<%= truncate(@query, length: 100, separator: ' ') %>"</span>
8
+ <% end %>
9
+ </p>
@@ -0,0 +1,11 @@
1
+ <%= link_to (module_link), :class => "see-all-results" do %>
2
+ <% short_display_name = I18n.t("#{service_name}_search.short_display_name") %>
3
+ <i class='fa fa-angle-right'></i>
4
+ <% if total == '1' %>
5
+ <%= I18n.t("#{service_name}_search.see_all_message", :default => "See #{total} #{short_display_name} result") %>
6
+ <% elsif total == '2' or total == '3' %>
7
+ <%= I18n.t("#{service_name}_search.see_all_message", :default => "See #{total} #{short_display_name} results") %>
8
+ <% else %>
9
+ <%= I18n.t("#{service_name}_search.see_all_message", :default => "See all #{total} #{short_display_name} results") %>
10
+ <% end %>
11
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <% if service_name == 'best_bets' %>
2
+ <%= render partial: 'layouts/quick_search/best_bets', locals: { best_bets: searcher.results.first } %>
3
+ <% elsif service_name == 'spelling_suggestion' %>
4
+ <%= render partial: 'layouts/quick_search/spelling_suggestion', locals: { spelling_suggestion: searcher.spelling_suggestion } %>
5
+ <% elsif service_name == 'related_topics' %>
6
+ <%= render partial: 'layouts/quick_search/related_topics', locals: { related_topics: searcher.related_topics } %>
7
+ <% elsif service_name == 'topic_snippet' %>
8
+ <%= render partial: 'layouts/quick_search/topic_snippet', locals: { topic_snippet: searcher.topic_snippet } %>
9
+ <% elsif service_name == 'smart_subjects' %>
10
+ <% unless searcher.results.blank? %>
11
+ <%= render_module(searcher, service_name) %>
12
+ <% end %>
13
+ <% else %>
14
+ <%= render_module(searcher, service_name) %>
15
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if service_name == 'best_bets' %>
2
+ <%= searcher.results.first %>
3
+ <% elsif service_name == 'spelling_suggestion' %>
4
+ <%= searcher.spelling_suggestion %>
5
+ <% elsif service_name == 'related_topics' %>
6
+ <%# searcher.related_topics.each do |topic| %>
7
+ <%# topic %>
8
+ <%# end %>
9
+ <%= searcher.related_topics %>
10
+ <% elsif service_name == 'topic_snippet' %>
11
+ <%= searcher.topic_snippet %>
12
+ <% else %>
13
+ <%= searcher.results %>
14
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render_module(searcher, service_name, '/quick_search/search/module_with_paging') %>
@@ -0,0 +1,100 @@
1
+ <% title %>
2
+ <%= render partial: 'layouts/quick_search/page_title', locals: { page_title: @page_title } %>
3
+ <%= render partial: 'layouts/quick_search/search_form' %>
4
+ <div id="quicksearch-ga-debug">
5
+ <ol></ol>
6
+ </div>
7
+ <div class="quicksearch-ga-click-tracking">
8
+ <div id="result-types" class="row">
9
+ <div class="small-12 columns result-types">
10
+ <%= render partial: 'layouts/quick_search/found_types' %>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ <%# FIXME: This logic could stand a second look %>
15
+ <% unless @summon.is_a? StandardError %>
16
+ <% unless @best_bets.is_a? StandardError %>
17
+ <% if @best_bets.results.blank? %>
18
+ <% unless @summon.spelling_suggestion.blank? %>
19
+ <%= render partial: 'layouts/quick_search/spelling_suggestion', locals: { spelling_suggestion: @summon.spelling_suggestion} %>
20
+ <% end %>
21
+ <% end %>
22
+ <% end %>
23
+ <% else %>
24
+ <div id="spelling-suggestion" class="hidden"></div>
25
+ <% end %>
26
+ <div class="row">
27
+ <div class="small-12 large-8 columns">
28
+ <% if @best_bets.is_a? StandardError %>
29
+ <div class="search-error silent-search-error" data-quicksearch-search-endpoint="best_bets"></div>
30
+ <% else %>
31
+ <% unless @best_bets.results.blank? %>
32
+ <%= render partial: 'layouts/quick_search/best_bets', locals: { best_bets: get_best_bets_data(@best_bets)} %>
33
+ <% end %>
34
+ <% end %>
35
+ </div>
36
+ </div>
37
+ <div class="quicksearch-ga-click-tracking">
38
+ <div class="row articles-catalog">
39
+ <div class="small-12 medium-6 columns summon module">
40
+ <%= render_module(@summon, 'summon') %>
41
+ </div>
42
+ <div class="small-12 medium-6 columns catalog module">
43
+ <%= render_module(@catalog, 'catalog') %>
44
+ </div>
45
+ <hr>
46
+ </div>
47
+ <div class="row journals-databases">
48
+ <div class="small-12 columns"><h4 class='section-description'>Other Ways to Find Articles</h4></div>
49
+ <div class="small-12 medium-4 columns journals module">
50
+ <%= render_module(@ematrix_journal, 'ematrix_journal') %>
51
+ </div>
52
+ <div class="small-12 medium-4 columns databases module">
53
+ <%= render_module(@ematrix_database, 'ematrix_database') %>
54
+ </div>
55
+ <div class="small-12 medium-4 columns smart-subjects module">
56
+ <% if @smart_subjects.is_a? StandardError %>
57
+ <div class="search-error silent-search-error" data-quicksearch-search-endpoint="smart_subjects"></div>
58
+ <% else %>
59
+ <% unless @smart_subjects.results.blank? %>
60
+ <%= render_module(@smart_subjects, 'smart_subjects') %>
61
+ <% end %>
62
+ <% end %>
63
+ </div>
64
+ <hr>
65
+ </div>
66
+ <div class="row website-faq">
67
+ <div class="small-12 columns"><h4 class='section-description'>Information About the Libraries</h4></div>
68
+ <div class="small-12 medium-4 medium-push-8 columns faq module">
69
+ <% if @faq.is_a? StandardError %>
70
+ <div class="search-error silent-search-error" data-quicksearch-search-endpoint="faq"></div>
71
+ <% else %>
72
+ <% unless @faq.results.blank? %>
73
+ <%= render_module(@faq, 'faq') %>
74
+ <% end %>
75
+ <% end %>
76
+ </div>
77
+ <div class="small-12 medium-8 medium-pull-4 columns website module">
78
+ <%= render_module(@website, 'website') %>
79
+ </div>
80
+ </div>
81
+
82
+ <div class="row">
83
+ <div class="small-12 columns panel">
84
+ <div class="row">
85
+ <% unless @summon.is_a? StandardError %>
86
+ <% unless @summon.related_topics.blank? %>
87
+ <div id="related-topics" class="small-12 medium-7 columns module related-topics">
88
+ <%= render partial: 'layouts/quick_search/related_topics', locals: {related_topics: @summon.related_topics} %>
89
+ </div>
90
+ <% end %>
91
+ <% else %>
92
+ <div id="related-topics" class="hidden small-12 medium-7 columns module related-topics"></div>
93
+ <% end %>
94
+ <div id="more-options" class="small-12 medium-5 columns more-options">
95
+ <%= render partial: 'layouts/quick_search/more_options' %>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </div>
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env)
8
+
9
+ module QuickSearch
10
+ class Engine < ::Rails::Engine
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+ config.time_zone = 'Eastern Time (US & Canada)'
18
+
19
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+ # config.i18n.default_locale = :de
22
+ config.middleware.use Rack::SslEnforcer, :only => /\/appstats\/?.*/, only_environments: ['production']
23
+
24
+ end
25
+ end
@@ -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
data/config/boot.rb ADDED
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,31 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ staging:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
26
+
27
+ production:
28
+ adapter: sqlite3
29
+ database: db/production.sqlite3
30
+ pool: 5
31
+ timeout: 5000
@@ -0,0 +1,30 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ call_to_try_searches: "Common searches"
24
+ citation_labels:
25
+ volume: 'Vol.'
26
+ issue: 'Issue'
27
+ page: 'p.'
28
+ pages: 'pp.'
29
+ best_bets_search:
30
+ display_name: "Best Bet"
@@ -0,0 +1,69 @@
1
+ # This is an example QuickSearch config file
2
+
3
+ defaults: &defaults
4
+ # Theme name
5
+ theme: 'quicksearch_generic_theme'
6
+ # Searchers that QuickSearch will use
7
+ searchers: [best_bets,arxiv,open_library,wikipedia,placeholder]
8
+ # Searchers listed in the "result type guide" bar that lists result types that were found
9
+ found_types: [arxiv,open_library,wikipedia,placeholder,placeholder,placeholder,placeholder]
10
+ per_page: 3
11
+ max_per_page: 50
12
+ # Timeout for server side searcher requests (in seconds)
13
+ http_timeout: 1
14
+ # Timeout for client side searcher request (in seconds)
15
+ xhr_http_timeout: 15
16
+ # Google Analytics tracking ID
17
+ google_analytics_tracking_id: "my_tracking_id"
18
+
19
+ # Username/password for QuickSearch stats view
20
+ user: "stats"
21
+ password: "stats"
22
+
23
+ # Regular expression for on-campus IP address detection (if needed for any reason)
24
+ on_campus:
25
+ - !ruby/regexp '/^192\.(1|168)\.\d*\.\d*$/'
26
+
27
+ # Common searches that appear on the index page of QuickSearch as example searches
28
+ common_searches: ["web of science", "google scholar", "refworks", "harvard business review", "pubmed", "ieee"]
29
+
30
+ # Loaded searches - these appear at the bottom of the results page as additional places to try the current search
31
+ loaded_searches:
32
+ - name: "Google Scholar"
33
+ landing_page: "http://scholar.google.com/"
34
+ query: "https://scholar.google.com/scholar?hl=en&q="
35
+ - name: "WorldCat"
36
+ landing_page: "https://www.worldcat.org"
37
+ query: "https://www.worldcat.org/search?qt=worldcat_org_all&q="
38
+ - name: "Google"
39
+ landing_page: "https://www.google.com/"
40
+ query: "https://www.google.com/#q="
41
+
42
+ # QuickSearch automatically resolves queries that look like DOIs. You can set an alternate resolver here
43
+ doi_loaded_link: "http://doi.org/"
44
+
45
+ # Location of BestBets solr index
46
+ best_bets:
47
+ solr_url: "http://localhost:8983/solr/bestbets/select?"
48
+
49
+ # QuickSearch supports realtime viewing of queries (behind authentication). Set the path of a websockets
50
+ # server here to enable this functionality
51
+ realtime_url: "http://path_to_websockets_server"
52
+
53
+ development:
54
+ <<: *defaults
55
+ # realtime_url: http://path_to_websockets_server
56
+
57
+ test:
58
+ <<: *defaults
59
+
60
+ staging:
61
+ <<: *defaults
62
+ # realtime_url: http://path_to_websockets_server
63
+ # google_analytics_tracking_id: ""
64
+
65
+
66
+ production:
67
+ <<: *defaults
68
+ # realtime_url: http://path_to_websockets_server
69
+ # Add or override config options here