blacklight_advanced_search 6.4.1 → 8.0.0.alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +125 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +4 -2
  5. data/.rubocop_todo.yml +6 -374
  6. data/Gemfile +3 -8
  7. data/README.md +46 -60
  8. data/Rakefile +2 -2
  9. data/VERSION +1 -1
  10. data/blacklight_advanced_search.gemspec +6 -7
  11. data/config/routes.rb +1 -1
  12. data/lib/blacklight_advanced_search/advanced_query_parser.rb +24 -38
  13. data/lib/blacklight_advanced_search/advanced_search_builder.rb +27 -24
  14. data/lib/blacklight_advanced_search/controller.rb +15 -16
  15. data/lib/blacklight_advanced_search/engine.rb +0 -1
  16. data/lib/blacklight_advanced_search/redirect_legacy_params_filter.rb +24 -7
  17. data/lib/blacklight_advanced_search.rb +0 -4
  18. data/lib/generators/blacklight_advanced_search/install_generator.rb +3 -37
  19. data/lib/parsing_nesting/grammar.rb +0 -12
  20. data/solr/conf/schema.xml +326 -573
  21. data/solr/conf/solrconfig.xml +80 -294
  22. data/spec/features/blacklight_advanced_search_form_spec.rb +13 -18
  23. data/spec/lib/advanced_search_builder_spec.rb +11 -9
  24. data/spec/spec_helper.rb +46 -14
  25. data/spec/test_app_templates/app/controllers/catalog_controller.rb +5 -7
  26. metadata +41 -62
  27. data/.travis.yml +0 -21
  28. data/app/assets/javascripts/blacklight_advanced_search.js +0 -5
  29. data/app/assets/stylesheets/blacklight_advanced_search/advanced_results.css +0 -21
  30. data/app/assets/stylesheets/blacklight_advanced_search/blacklight_advanced_search_styles.css.scss +0 -58
  31. data/app/assets/stylesheets/blacklight_advanced_search.css +0 -6
  32. data/app/controllers/advanced_controller.rb +0 -25
  33. data/app/controllers/blacklight_advanced_search/advanced_controller.rb +0 -25
  34. data/app/helpers/advanced_helper.rb +0 -4
  35. data/app/helpers/blacklight_advanced_search/advanced_helper_behavior.rb +0 -57
  36. data/app/views/advanced/_advanced_search_facets.html.erb +0 -16
  37. data/app/views/advanced/_advanced_search_facets_as_select.html.erb +0 -30
  38. data/app/views/advanced/_advanced_search_fields.html.erb +0 -8
  39. data/app/views/advanced/_advanced_search_form.html.erb +0 -43
  40. data/app/views/advanced/_advanced_search_help.html.erb +0 -24
  41. data/app/views/advanced/_advanced_search_submit_btns.html.erb +0 -12
  42. data/app/views/advanced/_facet_limit.html.erb +0 -15
  43. data/app/views/advanced/index.html.erb +0 -21
  44. data/app/views/blacklight_advanced_search/_facet_limit.html.erb +0 -16
  45. data/config/jetty.yml +0 -4
  46. data/config/locales/blacklight_advanced_search.en.yml +0 -12
  47. data/lib/blacklight_advanced_search/catalog_helper_override.rb +0 -30
  48. data/lib/blacklight_advanced_search/filter_parser.rb +0 -11
  49. data/lib/blacklight_advanced_search/parsing_nesting_parser.rb +0 -15
  50. data/lib/blacklight_advanced_search/render_constraints_override.rb +0 -136
  51. data/lib/generators/blacklight_advanced_search/assets_generator.rb +0 -53
  52. data/lib/generators/blacklight_advanced_search/templates/advanced_controller.rb +0 -56
  53. data/lib/generators/blacklight_advanced_search/templates/saved_searches_controller.rb +0 -6
  54. data/lib/generators/blacklight_advanced_search/templates/search_history_controller.rb +0 -6
  55. data/solr/sample_solr_documents.yml +0 -2692
  56. data/spec/helpers/advanced_helper_spec.rb +0 -13
  57. data/spec/lib/blacklight_advanced_search/render_constraints_override_spec.rb +0 -39
  58. data/spec/lib/filter_parser_spec.rb +0 -22
@@ -1,229 +1,93 @@
1
1
  <?xml version="1.0" encoding="UTF-8" ?>
2
- <!--
3
- Licensed to the Apache Software Foundation (ASF) under one or more
4
- contributor license agreements. See the NOTICE file distributed with
5
- this work for additional information regarding copyright ownership.
6
- The ASF licenses this file to You under the Apache License, Version 2.0
7
- (the "License"); you may not use this file except in compliance with
8
- the License. You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- -->
18
-
19
- <!--
20
- This is a stripped down config file used for a simple example...
21
- It is *not* a good example to work from.
22
- -->
23
2
  <config>
24
-
25
- <!-- Controls what version of Lucene various components of Solr
26
- adhere to. Generally, you want to use the latest version to
27
- get all bug fixes and improvements. It is highly recommended
28
- that you fully re-index after changing this setting as it can
29
- affect both how text is indexed and queried.
30
- -->
31
- <luceneMatchVersion>5.0.0</luceneMatchVersion>
32
-
33
- <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
34
- <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
3
+ <!-- NOTE: various comments and unused configuration possibilities have been purged
4
+ from this file. Please refer to http://wiki.apache.org/solr/SolrConfigXml,
5
+ as well as the default solrconfig file included with Solr -->
35
6
 
36
- <directoryFactory name="DirectoryFactory"
37
- class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}">
38
- </directoryFactory>
7
+ <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
39
8
 
40
- <codecFactory class="solr.SchemaCodecFactory"/>
9
+ <luceneMatchVersion>6.1.0</luceneMatchVersion>
41
10
 
42
- <schemaFactory class="ClassicIndexSchemaFactory"/>
11
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
43
12
 
13
+ <updateHandler class="solr.DirectUpdateHandler2">
14
+ <updateLog>
15
+ <str name="dir">${solr.core0.data.dir:}</str>
16
+ </updateLog>
17
+ </updateHandler>
44
18
 
45
- <dataDir>${solr.blacklight-core.data.dir:}</dataDir>
46
-
47
- <requestDispatcher handleSelect="true" >
48
- <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
49
- </requestDispatcher>
50
-
51
- <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
52
-
53
- <!-- config for the admin interface -->
54
- <admin>
55
- <defaultQuery>*:*</defaultQuery>
56
- </admin>
57
-
58
- <!-- SearchHandler
19
+ <!-- solr lib dirs -->
20
+ <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
21
+ <lib dir="${solr.install.dir:../../../..}/modules/analysis-extras/lib" />
22
+ <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
59
23
 
60
- http://wiki.apache.org/solr/SearchHandler
24
+ <dataDir>${solr.data.dir:}</dataDir>
61
25
 
62
- For processing Search Queries, the primary Request Handler
63
- provided with Solr is "SearchHandler" It delegates to a sequent
64
- of SearchComponents (see below) and supports distributed
65
- queries across multiple shards
66
- -->
67
26
  <requestHandler name="search" class="solr.SearchHandler" default="true">
68
27
  <!-- default values for query parameters can be specified, these
69
28
  will be overridden by parameters in the request
70
29
  -->
71
30
  <lst name="defaults">
72
- <str name="defType">dismax</str>
31
+ <str name="defType">edismax</str>
73
32
  <str name="echoParams">explicit</str>
74
- <int name="rows">10</int>
75
-
76
33
  <str name="q.alt">*:*</str>
77
34
  <str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
78
-
35
+ <int name="qs">1</int>
36
+ <int name="ps">2</int>
37
+ <float name="tie">0.01</float>
79
38
  <!-- this qf and pf are used by default, if not otherwise specified by
80
39
  client. The default blacklight_config will use these for the
81
- "keywords" search. See the author_qf/author_pf, title_qf, etc
40
+ "keywords" search. See the author_qf/author_pf, title_qf, etc
82
41
  below, which the default blacklight_config will specify for
83
42
  those searches. You may also be interested in:
84
43
  http://wiki.apache.org/solr/LocalParams
85
44
  -->
45
+ <str name="qf">
46
+ id
47
+ full_title_tsim
48
+ short_title_tsim
49
+ alternative_title_tsim
50
+ active_fedora_model_ssi
51
+ title_tsim
52
+ author_tsim
53
+ subject_tsim
54
+ all_text_timv
55
+ </str>
56
+ <str name="pf">
57
+ all_text_timv^10
58
+ </str>
86
59
 
87
- <str name="qf">
88
- title_unstem_search^100000
89
- subtitle_unstem_search^50000
90
- title_t^25000
91
- subtitle_t^10000
92
- title_addl_unstem_search^5000
93
- title_addl_t^2500
94
- title_added_entry_unstem_search^1500
95
- title_added_entry_t^1250
96
- subject_topic_unstem_search^1000
97
- subject_unstem_search^750
98
- subject_topic_facet^625
99
- subject_t^500
100
- author_unstem_search^250
101
- author_addl_unstem_search^250
102
- author_t^100
103
- author_addl_t^50
104
- subject_addl_unstem_search^250
105
- subject_addl_t^50
106
- title_series_unstem_search^25
107
- title_series_t^10
108
- isbn_t
109
- text
110
- </str>
111
- <str name="pf">
112
- title_unstem_search^1000000
113
- subtitle_unstem_search^500000
114
- title_t^250000
115
- subtitle_t^100000
116
- title_addl_unstem_search^50000
117
- title_addl_t^25000
118
- title_added_entry_unstem_search^15000
119
- title_added_entry_t^12500
120
- subject_topic_unstem_search^10000
121
- subject_unstem_search^7500
122
- subject_topic_facet^6250
123
- subject_t^5000
124
- author_unstem_search^2500
125
- author_addl_unstem_search^2500
126
- author_t^1000
127
- author_addl_t^500
128
- subject_addl_unstem_search^2500
129
- subject_addl_t^500
130
- title_series_unstem_search^250
131
- title_series_t^100
132
- text^10
133
- </str>
134
60
  <str name="author_qf">
135
- author_unstem_search^200
136
- author_addl_unstem_search^50
137
- author_t^20
138
- author_addl_t
61
+ author_tsim
139
62
  </str>
140
63
  <str name="author_pf">
141
- author_unstem_search^2000
142
- author_addl_unstem_search^500
143
- author_t^200
144
- author_addl_t^10
145
64
  </str>
146
65
  <str name="title_qf">
147
- title_unstem_search^50000
148
- subtitle_unstem_search^25000
149
- title_addl_unstem_search^10000
150
- title_t^5000
151
- subtitle_t^2500
152
- title_addl_t^100
153
- title_added_entry_unstem_search^50
154
- title_added_entry_t^10
155
- title_series_unstem_search^5
156
- title_series_t
66
+ title_tsim
67
+ full_title_tsim
68
+ short_title_tsim
69
+ alternative_title_tsim
157
70
  </str>
158
71
  <str name="title_pf">
159
- title_unstem_search^500000
160
- subtitle_unstem_search^250000
161
- title_addl_unstem_search^100000
162
- title_t^50000
163
- subtitle_t^25000
164
- title_addl_t^1000
165
- title_added_entry_unstem_search^500
166
- title_added_entry_t^100
167
- title_series_t^50
168
- title_series_unstem_search^10
169
72
  </str>
170
73
  <str name="subject_qf">
171
- subject_topic_unstem_search^200
172
- subject_unstem_search^125
173
- subject_topic_facet^100
174
- subject_t^50
175
- subject_addl_unstem_search^10
176
- subject_addl_t
74
+ subject_tsim
177
75
  </str>
178
76
  <str name="subject_pf">
179
- subject_topic_unstem_search^2000
180
- subject_unstem_search^1250
181
- subject_t^1000
182
- subject_topic_facet^500
183
- subject_addl_unstem_search^100
184
- subject_addl_t^10
185
77
  </str>
186
-
187
- <int name="ps">3</int>
188
- <float name="tie">0.01</float>
189
78
 
190
- <!-- NOT using marc_display because it is large and will slow things down for search results -->
191
79
  <str name="fl">
192
- id,
193
- score,
194
- author_display,
195
- author_vern_display,
196
- format,
197
- isbn_t,
198
- language_facet,
199
- lc_callnum_display,
200
- material_type_display,
201
- published_display,
202
- published_vern_display,
203
- pub_date,
204
- title_display,
205
- title_vern_display,
206
- subject_topic_facet,
207
- subject_geo_facet,
208
- subject_era_facet,
209
- subtitle_display,
210
- subtitle_vern_display,
211
- url_fulltext_display,
212
- url_suppl_display,
80
+ *,
81
+ score
213
82
  </str>
214
83
 
215
84
  <str name="facet">true</str>
216
85
  <str name="facet.mincount">1</str>
217
- <str name="facet.field">format</str>
218
- <str name="facet.field">lc_1letter_facet</str>
219
- <str name="facet.field">lc_alpha_facet</str>
220
- <str name="facet.field">lc_b4cutter_facet</str>
221
- <str name="facet.field">language_facet</str>
222
- <str name="facet.field">pub_date</str>
223
- <str name="facet.field">subject_era_facet</str>
224
- <str name="facet.field">subject_geo_facet</str>
225
- <str name="facet.field">subject_topic_facet</str>
226
-
86
+ <str name="facet.limit">10</str>
87
+ <str name="facet.field">active_fedora_model_ssi</str>
88
+ <str name="facet.field">subject_ssim</str>
89
+ <str name="facet.field">language_ssim</str>
90
+
227
91
  <str name="spellcheck">true</str>
228
92
  <str name="spellcheck.dictionary">default</str>
229
93
  <str name="spellcheck.onlyMorePopular">true</str>
@@ -232,91 +96,46 @@
232
96
  <str name="spellcheck.count">5</str>
233
97
 
234
98
  </lst>
235
- <!-- In addition to defaults, "appends" params can be specified
236
- to identify values which should be appended to the list of
237
- multi-val params from the query (or the existing "defaults").
238
- -->
239
- <!-- In this example, the param "fq=instock:true" would be appended to
240
- any query time fq params the user may specify, as a mechanism for
241
- partitioning the index, independent of any user selected filtering
242
- that may also be desired (perhaps as a result of faceted searching).
243
-
244
- NOTE: there is *absolutely* nothing a client can do to prevent these
245
- "appends" values from being used, so don't use this mechanism
246
- unless you are sure you always want it.
247
- -->
248
- <!--
249
- <lst name="appends">
250
- <str name="fq">inStock:true</str>
251
- </lst>
252
- -->
253
- <!-- "invariants" are a way of letting the Solr maintainer lock down
254
- the options available to Solr clients. Any params values
255
- specified here are used regardless of what values may be specified
256
- in either the query, the "defaults", or the "appends" params.
257
-
258
- In this example, the facet.field and facet.query params would
259
- be fixed, limiting the facets clients can use. Faceting is
260
- not turned on by default - but if the client does specify
261
- facet=true in the request, these are the only facets they
262
- will be able to see counts for; regardless of what other
263
- facet.field or facet.query params they may specify.
264
-
265
- NOTE: there is *absolutely* nothing a client can do to prevent these
266
- "invariants" values from being used, so don't use this mechanism
267
- unless you are sure you always want it.
268
- -->
269
- <!--
270
- <lst name="invariants">
271
- <str name="facet.field">cat</str>
272
- <str name="facet.field">manu_exact</str>
273
- <str name="facet.query">price:[* TO 500]</str>
274
- <str name="facet.query">price:[500 TO *]</str>
275
- </lst>
276
- -->
277
- <!-- If the default list of SearchComponents is not desired, that
278
- list can either be overridden completely, or components can be
279
- prepended or appended to the default list. (see below)
280
- -->
281
- <!--
282
- <arr name="components">
283
- <str>nameOfCustomComponent1</str>
284
- <str>nameOfCustomComponent2</str>
285
- </arr>
286
- -->
287
99
  <arr name="last-components">
288
100
  <str>spellcheck</str>
289
101
  </arr>
290
-
291
102
  </requestHandler>
292
103
 
293
- <!-- for requests to get a single document; use id=666 instead of q=id:666 -->
294
- <requestHandler name="document" class="solr.SearchHandler" >
104
+ <requestHandler name="permissions" class="solr.SearchHandler" >
295
105
  <lst name="defaults">
106
+ <str name="facet">off</str>
296
107
  <str name="echoParams">all</str>
297
- <str name="fl">*</str>
298
108
  <str name="rows">1</str>
299
- <str name="q">{!term f=id v=$id}</str> <!-- use id=666 instead of q=id:666 -->
109
+ <str name="q">{!raw f=id v=$id}</str> <!-- use id=666 instead of q=id:666 -->
110
+ <str name="fl">
111
+ id,
112
+ access_ssim,
113
+ discover_access_group_ssim,discover_access_person_ssim,
114
+ read_access_group_ssim,read_access_person_ssim,
115
+ edit_access_group_ssim,edit_access_person_ssim,
116
+ depositor_ti,
117
+ embargo_release_date_dtsi
118
+ inheritable_access_ssim,
119
+ inheritable_discover_access_group_ssim,inheritable_discover_access_person_ssim,
120
+ inheritable_read_access_group_ssim,inheritable_read_access_person_ssim,
121
+ inheritable_edit_access_group_ssim,inheritable_edit_access_person_ssim,
122
+ inheritable_embargo_release_date_dtsi
123
+ </str>
300
124
  </lst>
301
125
  </requestHandler>
302
126
 
303
- <!-- Spell Check
127
+ <requestHandler name="standard" class="solr.SearchHandler">
128
+ <lst name="defaults">
129
+ <str name="echoParams">explicit</str>
130
+ <str name="defType">lucene</str>
131
+ </lst>
132
+ </requestHandler>
304
133
 
305
- The spell check component can return a list of alternative spelling
306
- suggestions.
307
134
 
308
- http://wiki.apache.org/solr/SpellCheckComponent
309
- -->
310
135
  <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
311
-
312
136
  <str name="queryAnalyzerFieldType">textSpell</str>
313
-
314
- <!-- Multiple "Spell Checkers" can be declared and used by this
315
- component
316
- -->
317
-
318
- <!-- a spellchecker built from a field of the main index, and
319
- written to disk
137
+ <!-- Multiple "Spell Checkers" can be declared and used by this component
138
+ (e.g. for title_spell field)
320
139
  -->
321
140
  <lst name="spellchecker">
322
141
  <str name="name">default</str>
@@ -345,45 +164,6 @@
345
164
  <str name="accuracy">0.7</str>
346
165
  <str name="buildOnOptimize">true</str>
347
166
  </lst>
348
-
349
- <!-- a spellchecker that uses a different distance measure -->
350
- <!--
351
- <lst name="spellchecker">
352
- <str name="name">jarowinkler</str>
353
- <str name="field">spell</str>
354
- <str name="distanceMeasure">
355
- org.apache.lucene.search.spell.JaroWinklerDistance
356
- </str>
357
- <str name="spellcheckIndexDir">spellcheckerJaro</str>
358
- </lst>
359
- -->
360
-
361
- <!-- a spellchecker that use an alternate comparator
362
-
363
- comparatorClass be one of:
364
- 1. score (default)
365
- 2. freq (Frequency first, then score)
366
- 3. A fully qualified class name
367
- -->
368
- <!--
369
- <lst name="spellchecker">
370
- <str name="name">freq</str>
371
- <str name="field">lowerfilt</str>
372
- <str name="spellcheckIndexDir">spellcheckerFreq</str>
373
- <str name="comparatorClass">freq</str>
374
- <str name="buildOnCommit">true</str>
375
- -->
376
-
377
- <!-- A spellchecker that reads the list of words from a file -->
378
- <!--
379
- <lst name="spellchecker">
380
- <str name="classname">solr.FileBasedSpellChecker</str>
381
- <str name="name">file</str>
382
- <str name="sourceLocation">spellings.txt</str>
383
- <str name="characterEncoding">UTF-8</str>
384
- <str name="spellcheckIndexDir">spellcheckerFile</str>
385
- </lst>
386
- -->
387
167
  </searchComponent>
388
168
 
389
169
  <searchComponent name="suggest" class="solr.SuggestComponent">
@@ -407,5 +187,11 @@
407
187
  </arr>
408
188
  </requestHandler>
409
189
 
410
- </config>
190
+ <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
191
+
192
+ <requestDispatcher handleSelect="true" >
193
+ <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048" />
194
+ </requestDispatcher>
411
195
 
196
+ <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
197
+ </config>
@@ -1,8 +1,4 @@
1
1
  describe "Blacklight Advanced Search Form" do
2
- before(:all) do
3
- AdvancedController.copy_blacklight_config_from(CatalogController)
4
- end
5
-
6
2
  describe "advanced search form" do
7
3
  before do
8
4
  visit '/advanced?hypothetical_existing_param=true&q=ignore+this+existing+query'
@@ -17,33 +13,33 @@ describe "Blacklight Advanced Search Form" do
17
13
  it "should give the user a choice between and/or queries" do
18
14
  expect(page).to have_selector('#op')
19
15
  within('#op') do
20
- expect(page).to have_selector('option[value="AND"]')
21
- expect(page).to have_selector('option[value="OR"]')
16
+ expect(page).to have_selector('option[value="must"]')
17
+ expect(page).to have_selector('option[value="should"]')
22
18
  end
23
19
  end
24
20
 
25
21
  it "should list the configured search fields" do
26
- expect(page).to have_selector '.advanced-search-field #title'
27
- expect(page).to have_selector '.advanced-search-field #author'
22
+ expect(page).to have_field 'Title'
23
+ expect(page).to have_field 'Author'
28
24
  end
29
25
 
30
26
  it "should not list the search fields listed as not to be included in adv search" do
31
- expect(page).not_to have_selector '.advanced_search_field #dummy_field'
27
+ expect(page).not_to have_field 'Dummy field'
32
28
  end
33
29
  end
34
30
 
35
31
  describe "facet column" do
36
32
  it "should list facets" do
37
- expect(page).to have_selector('.blacklight-language_facet')
33
+ expect(page).to have_selector('.blacklight-language_ssim')
38
34
 
39
- within('.blacklight-language_facet') do
40
- expect(page).to have_content "Language Facet"
35
+ within('.blacklight-language_ssim') do
36
+ expect(page).to have_content "Language Ssim"
41
37
  end
42
38
  end
43
39
  end
44
40
 
45
41
  it "scope searches to fields" do
46
- fill_in "title", :with => "Medicine"
42
+ fill_in "Title", :with => "Medicine"
47
43
  click_on "advanced-search-submit"
48
44
  expect(page).to have_content "Remove constraint Title: Medicine"
49
45
  expect(page).to have_content "2007020969"
@@ -52,21 +48,20 @@ describe "Blacklight Advanced Search Form" do
52
48
 
53
49
  it "should show the search fields" do
54
50
  visit '/advanced'
55
- expect(page).to have_selector('input#title')
51
+ expect(page).to have_field 'Title'
56
52
  end
57
53
 
58
54
  describe "prepopulated advanced search form" do
59
55
  before do
60
- visit '/advanced?all_fields=&author=&commit=Search&op=AND&search_field=advanced&title=cheese'
56
+ visit '/advanced?clause[0][field]=title&clause[0][query]=cheese'
61
57
  end
62
58
 
63
59
  it "should not create hidden inputs for search fields" do
64
- expect(page).not_to have_selector('.advanced input[type="hidden"][name="title"]', visible: false)
65
- expect(page).to have_selector('.advanced input[type="text"][name="title"]')
60
+ expect(page).to have_field 'Title', with: 'cheese'
66
61
  end
67
62
 
68
63
  it "should not have multiple parameters for a search field" do
69
- fill_in "title", :with => "bread"
64
+ fill_in "Title", :with => "bread"
70
65
  click_on "advanced-search-submit"
71
66
  expect(page.current_url).to match(/bread/)
72
67
  expect(page.current_url).not_to match(/cheese/)
@@ -10,17 +10,19 @@ describe BlacklightAdvancedSearch::AdvancedSearchBuilder do
10
10
  end
11
11
  end
12
12
 
13
- let(:obj) do
14
- class BACTestClass
15
- cattr_accessor :blacklight_config, :blacklight_params
16
- include Blacklight::SearchHelper
13
+ let(:context) { CatalogController.new }
14
+
15
+ before { allow(context).to receive(:blacklight_config).and_return(blacklight_config) }
16
+
17
+ let(:search_builder_class) do
18
+ Class.new(Blacklight::SearchBuilder) do
17
19
  include BlacklightAdvancedSearch::AdvancedSearchBuilder
18
- def initialize(blacklight_config, blacklight_params)
19
- self.blacklight_config = blacklight_config
20
- self.blacklight_params = blacklight_params
21
- end
22
20
  end
23
- BACTestClass.new blacklight_config, params
21
+ end
22
+ let(:search_builder) { search_builder_class.new(context) }
23
+
24
+ let(:obj) do
25
+ search_builder.with(params)
24
26
  end
25
27
 
26
28
  let(:params) { {} }
data/spec/spec_helper.rb CHANGED
@@ -9,19 +9,51 @@ require 'rspec/rails'
9
9
  require 'capybara/rails'
10
10
 
11
11
  RSpec.configure do |config|
12
- # Maintain this rspec2 behavior even in rspec3, until we
13
- # adjust our stuff. Deprecation warning was:
14
- # --------------------------------------------------------------------------------
15
- # rspec-rails 3 will no longer automatically infer an example group's spec type
16
- # from the file location. You can explicitly opt-in to this feature using this
17
- # snippet:
18
-
19
- # RSpec.configure do |config|
20
- # config.infer_spec_type_from_file_location!
21
- # end
22
-
23
- # If you wish to manually label spec types via metadata you can safely ignore
24
- # this warning and continue upgrading to RSpec 3 without addressing it.
25
- # --------------------------------------------------------------------------------
26
12
  config.infer_spec_type_from_file_location!
13
+ config.filter_rails_from_backtrace!
14
+
15
+ config.use_transactional_fixtures = true
16
+
17
+ config.expect_with :rspec do |expectations|
18
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
19
+ end
20
+
21
+ config.default_formatter = 'doc' if config.files_to_run.one?
22
+
23
+ config.shared_context_metadata_behavior = :apply_to_host_groups
24
+
25
+ # This allows you to limit a spec run to individual examples or groups
26
+ # you care about by tagging them with `:focus` metadata. When nothing
27
+ # is tagged with `:focus`, all examples get run. RSpec also provides
28
+ # aliases for `it`, `describe`, and `context` that include `:focus`
29
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
30
+ config.filter_run_when_matching :focus
31
+
32
+ config.example_status_persistence_file_path = 'spec/examples.txt'
33
+ # Many RSpec users commonly either run the entire suite or an individual
34
+ # file, and it's useful to allow more verbose output when running an
35
+ # individual spec file.
36
+ if config.files_to_run.one?
37
+ # Use the documentation formatter for detailed output,
38
+ # unless a formatter has already been configured
39
+ # (e.g. via a command-line flag).
40
+ config.default_formatter = 'doc'
41
+ end
42
+
43
+ # Print the 10 slowest examples and example groups at the
44
+ # end of the spec run, to help surface which specs are running
45
+ # particularly slow.
46
+ config.profile_examples = 10
47
+
48
+ # Run specs in random order to surface order dependencies. If you find an
49
+ # order dependency and want to debug it, you can fix the order by providing
50
+ # the seed, which is printed after each run.
51
+ # --seed 1234
52
+ # config.order = :random
53
+
54
+ # Seed global randomization in this process using the `--seed` CLI option.
55
+ # Setting this allows you to use `--seed` to deterministically reproduce
56
+ # test failures related to randomization by passing the same `--seed` value
57
+ # as the one that triggered the failure.
58
+ Kernel.srand config.seed
27
59
  end
@@ -1,12 +1,10 @@
1
1
  class CatalogController < ApplicationController
2
2
  include Blacklight::Catalog
3
- include BlacklightAdvancedSearch::Controller
4
3
 
5
4
  configure_blacklight do |config|
6
5
  # default advanced config values
7
6
  config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
8
- # config.advanced_search[:qt] ||= 'advanced'
9
- config.advanced_search[:url_key] ||= 'advanced'
7
+ config.advanced_search[:enabled] = true
10
8
  config.advanced_search[:query_parser] ||= 'dismax'
11
9
  config.advanced_search[:form_solr_parameters] ||= {}
12
10
 
@@ -15,19 +13,19 @@ class CatalogController < ApplicationController
15
13
  :rows => 10
16
14
  }
17
15
 
18
- config.add_facet_field 'language_facet'
16
+ config.add_facet_field 'language_ssim'
19
17
 
20
18
  config.add_search_field('title') do |field|
21
- field.solr_local_parameters = { :qf => "title_t", :pf => "title_t" }
19
+ field.solr_local_parameters = { :qf => "title_tsim", :pf => "title_tsim" }
22
20
  end
23
21
 
24
22
  config.add_search_field('author') do |field|
25
- field.solr_local_parameters = { :qf => "author_t", :pf => "author_t" }
23
+ field.solr_local_parameters = { :qf => "author_tsim", :pf => "author_tsim" }
26
24
  end
27
25
 
28
26
  config.add_search_field('dummy_field') do |field|
29
27
  field.include_in_advanced_search = false
30
- field.solr_local_parameters = { :qf => "author_t", :pf => "author_t" }
28
+ field.solr_local_parameters = { :qf => "author_tsim", :pf => "author_tsim" }
31
29
  end
32
30
  end
33
31
  end