blacklight-maps 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,8 +17,8 @@
17
17
  -->
18
18
 
19
19
  <!--
20
- This is a stripped down config file used for a simple example...
21
- It is *not* a good example to work from.
20
+ This is a stripped down config file used for a simple example...
21
+ It is *not* a good example to work from.
22
22
  -->
23
23
  <config>
24
24
  <luceneMatchVersion>LUCENE_40</luceneMatchVersion>
@@ -31,18 +31,18 @@
31
31
  <lib dir="../lib/contrib/analysis-extras/lucene-libs" />
32
32
 
33
33
  <dataDir>${solr.blacklight-core.data.dir:}</dataDir>
34
-
35
- <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
34
+
35
+ <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
36
36
 
37
37
  <requestDispatcher handleSelect="true" >
38
38
  <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
39
39
  </requestDispatcher>
40
-
40
+
41
41
  <requestHandler name="standard" class="solr.StandardRequestHandler" />
42
42
  <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
43
43
  <requestHandler name="/update" class="solr.UpdateRequestHandler" />
44
44
  <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
45
-
45
+
46
46
  <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
47
47
  <lst name="invariants">
48
48
  <str name="q">solrpingquery</str>
@@ -51,8 +51,8 @@
51
51
  <str name="echoParams">all</str>
52
52
  </lst>
53
53
  </requestHandler>
54
-
55
- <!-- config for the admin interface -->
54
+
55
+ <!-- config for the admin interface -->
56
56
  <admin>
57
57
  <defaultQuery>solr</defaultQuery>
58
58
  </admin>
@@ -80,7 +80,7 @@
80
80
 
81
81
  <!-- this qf and pf are used by default, if not otherwise specified by
82
82
  client. The default blacklight_config will use these for the
83
- "keywords" search. See the author_qf/author_pf, title_qf, etc
83
+ "keywords" search. See the author_qf/author_pf, title_qf, etc
84
84
  below, which the default blacklight_config will specify for
85
85
  those searches. You may also be interested in:
86
86
  http://wiki.apache.org/solr/LocalParams
@@ -185,21 +185,21 @@
185
185
  subject_addl_unstem_search^100
186
186
  subject_addl_t^10
187
187
  </str>
188
-
188
+
189
189
  <int name="ps">3</int>
190
190
  <float name="tie">0.01</float>
191
191
 
192
192
  <!-- NOT using marc_display because it is large and will slow things down for search results -->
193
193
  <str name="fl">
194
- id,
194
+ id,
195
195
  score,
196
196
  author_display,
197
- author_vern_display,
198
- format,
199
- isbn_t,
200
- language_facet,
197
+ author_vern_display,
198
+ format,
199
+ isbn_t,
200
+ language_facet,
201
201
  lc_callnum_display,
202
- material_type_display,
202
+ material_type_display,
203
203
  published_display,
204
204
  published_vern_display,
205
205
  pub_date,
@@ -212,7 +212,8 @@
212
212
  subtitle_vern_display,
213
213
  url_fulltext_display,
214
214
  url_suppl_display,
215
- placename_coords
215
+ placename_coords,
216
+ place_bbox
216
217
  </str>
217
218
 
218
219
  <str name="facet">true</str>
@@ -290,7 +291,7 @@
290
291
  <arr name="last-components">
291
292
  <str>spellcheck</str>
292
293
  </arr>
293
-
294
+
294
295
  </requestHandler>
295
296
 
296
297
  <!-- for requests to get a single document; use id=666 instead of q=id:666 -->
@@ -308,16 +309,16 @@
308
309
  <lst name="defaults">
309
310
  <str name="defType">lucene</str>
310
311
  <str name="echoParams">explicit</str>
311
- <str name="sort">score desc, pub_date_sort desc, title_sort asc</str>
312
- <str name="df">text</str>
313
- <str name="q.op">AND</str>
312
+ <str name="sort">score desc, pub_date_sort desc, title_sort asc</str>
313
+ <str name="df">text</str>
314
+ <str name="q.op">AND</str>
314
315
  <str name="qs">1</str>
315
316
 
316
317
  <!-- used for dismax query parser -->
317
- <str name="mm">1</str>
318
- <str name="ps">3</str>
318
+ <str name="mm">1</str>
319
+ <str name="ps">3</str>
319
320
  <float name="tie">0.01</float>
320
-
321
+
321
322
  <!-- for user query terms in author text box -->
322
323
  <str name="qf_author">
323
324
  author_unstem_search^200
@@ -331,7 +332,7 @@
331
332
  author_t^200
332
333
  author_addl_t^10
333
334
  </str>
334
-
335
+
335
336
  <!-- for user query terms in title text box -->
336
337
  <str name="qf_title">
337
338
  title_unstem_search^50000
@@ -357,7 +358,7 @@
357
358
  title_series_t^50
358
359
  title_series_unstem_search^10
359
360
  </str>
360
-
361
+
361
362
  <!-- for user query terms in subject text box -->
362
363
  <str name="qf_subject">
363
364
  subject_topic_unstem_search^200
@@ -375,25 +376,25 @@
375
376
  subject_addl_unstem_search^100
376
377
  subject_addl_t^10
377
378
  </str>
378
-
379
+
379
380
  <!-- for user query terms in number text box -->
380
381
  <str name="qf_number">isbn_t</str>
381
-
382
+
382
383
  <!-- for user query terms in keyword text box -->
383
384
  <str name="qf_keyword">text</str>
384
385
  <str name="pf_keyword">text^10</str>
385
-
386
+
386
387
  <!-- NOT using marc_display because it is large and will slow things down for search results -->
387
388
  <str name="fl">
388
- id,
389
+ id,
389
390
  score,
390
391
  author_display,
391
- author_vern_display,
392
- format,
393
- isbn_t,
394
- language_facet,
392
+ author_vern_display,
393
+ format,
394
+ isbn_t,
395
+ language_facet,
395
396
  lc_callnum_display,
396
- material_type_display,
397
+ material_type_display,
397
398
  published_display,
398
399
  published_vern_display,
399
400
  pub_date,
@@ -407,7 +408,7 @@
407
408
  url_fulltext_display,
408
409
  url_suppl_display,
409
410
  </str>
410
-
411
+
411
412
  <str name="facet">true</str>
412
413
  <str name="facet.mincount">1</str>
413
414
  <str name="facet.limit">10</str>
@@ -420,7 +421,7 @@
420
421
  <str name="facet.field">subject_era_facet</str>
421
422
  <str name="facet.field">subject_geo_facet</str>
422
423
  <str name="facet.field">subject_topic_facet</str>
423
-
424
+
424
425
  <str name="spellcheck">true</str>
425
426
  <str name="spellcheck.dictionary">subject</str>
426
427
  <str name="spellcheck.onlyMorePopular">true</str>
@@ -436,7 +437,7 @@
436
437
  <!-- Spell Check
437
438
 
438
439
  The spell check component can return a list of alternative spelling
439
- suggestions.
440
+ suggestions.
440
441
 
441
442
  http://wiki.apache.org/solr/SpellCheckComponent
442
443
  -->
@@ -491,7 +492,7 @@
491
492
  </lst>
492
493
  -->
493
494
 
494
- <!-- a spellchecker that use an alternate comparator
495
+ <!-- a spellchecker that use an alternate comparator
495
496
 
496
497
  comparatorClass be one of:
497
498
  1. score (default)
@@ -520,4 +521,3 @@
520
521
  </searchComponent>
521
522
 
522
523
  </config>
523
-
@@ -1,79 +1,108 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Map view", :js => true do
4
- before { visit catalog_index_path :q => 'tibet', :view => 'maps' }
3
+ describe "Map View", js: true do
4
+
5
+ describe "using placename coords" do
6
+ before do
7
+ CatalogController.blacklight_config = Blacklight::Configuration.new
8
+ CatalogController.configure_blacklight do |config|
9
+ config.view.maps.type = 'placename_coord'
10
+ config.view.maps.placename_coord_delimiter = '-|-'
11
+ # These fields also need to be added for some reason for the tests to pass
12
+ # Link in list is not being generated correctly if not passed
13
+ config.index.title_field = 'title_display'
14
+ end
15
+ end
5
16
 
6
- it "should display results in a map" do
7
- expect(page).to have_selector("#documents.map")
8
- end
17
+ before { visit catalog_index_path :q => 'tibet', :view => 'maps' }
9
18
 
10
- it "should contain map div" do
11
- expect(page).to have_selector("#blacklight-map")
12
- end
19
+ it "should display map elements" do
20
+ expect(page).to have_selector("#documents.map")
21
+ expect(page).to have_selector("#blacklight-map")
22
+ expect(page).to have_selector("#blacklight-map-sidebar")
23
+ end
13
24
 
14
- it "should contain leaflet-sidebar div" do
15
- expect(page).to have_selector("#blacklight-map-sidebar")
16
- end
25
+ describe "data attributes" do
17
26
 
18
- describe "Data attributes" do
27
+ it "maxzoom should be 8" do
28
+ expect(page).to have_selector("#blacklight-map[data-maxzoom='8']")
29
+ end
19
30
 
20
- it "maxzoom should be 8" do
21
- expect(page).to have_selector("#blacklight-map[data-maxzoom='8']")
22
- end
31
+ it "type should be placename_coord" do
32
+ expect(page).to have_selector("#blacklight-map[data-type='placename_coord']")
33
+ end
23
34
 
24
- end
35
+ it "tileurl should be OSM" do
36
+ expect(page).to have_selector("#blacklight-map[data-tileurl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png']")
37
+ end
25
38
 
26
- describe "Marker clusters" do
27
-
28
- it "should have marker cluster div" do
29
- expect(page).to have_selector("div.marker-cluster")
30
39
  end
31
40
 
32
- it "should only have one marker cluster" do
33
- expect(page).to have_selector('div.marker-cluster', count: 1)
34
- end
41
+ describe "marker clusters" do
35
42
 
36
- it "should have 4 markers" do
37
- expect(find("div.marker-cluster")).to have_content(4)
38
- end
43
+ it "should have marker cluster div" do
44
+ expect(page).to have_selector("div.marker-cluster")
45
+ end
39
46
 
40
- it "should display tile layer attribution" do
41
- expect(find("div.leaflet-control-container")).to have_content('OpenStreetMap contributors, CC-BY-SA')
42
- end
47
+ it "should only have one marker cluster" do
48
+ expect(page).to have_selector('div.marker-cluster', count: 1)
49
+ end
43
50
 
44
- describe "Click Marker cluster" do
45
- before { find("div.marker-cluster").click }
46
-
47
- it "should have three marker clusters" do
48
- expect(page).to have_selector('div.marker-cluster', count: 3)
51
+ it "should have 4 markers" do
52
+ expect(find("div.marker-cluster")).to have_content(4)
49
53
  end
50
54
 
51
- describe "Click low level marker cluster" do
52
- before { find("div.marker-cluster[title='India']").click }
55
+ it "should display tile layer attribution" do
56
+ expect(find("div.leaflet-control-container")).to have_content('OpenStreetMap contributors, CC-BY-SA')
57
+ end
53
58
 
54
- it "should show sidebar with content" do
55
- expect(page).to have_content("yon")
59
+ describe "Click Marker cluster" do
60
+ before { find("div.marker-cluster").click }
61
+
62
+ it "should have three marker clusters" do
63
+ expect(page).to have_selector('div.marker-cluster', count: 3)
56
64
  end
57
65
 
58
- describe "Navigate to catalog page" do
59
- before { click_link("es yon") }
66
+ describe "Click low level marker cluster" do
67
+ before { find("div.marker-cluster[title='India']").click }
60
68
 
61
69
  it "should show sidebar with content" do
62
- expect(page).to have_content("Dharamsala, Distt. Kangra, H.P.")
70
+ expect(page).to have_content("es yon")
63
71
  end
64
72
 
65
- end
73
+ describe "Navigate to catalog page" do
74
+ before { click_link("es yon") }
66
75
 
76
+ it "should show page with content" do
77
+ expect(page).to have_content("es yon")
78
+ end
79
+ end
80
+ end
67
81
  end
82
+ end
83
+ end
68
84
 
85
+ describe "using bounding box" do
86
+ before do
87
+ CatalogController.blacklight_config = Blacklight::Configuration.new
88
+ CatalogController.configure_blacklight do |config|
89
+ config.view.maps.type = 'bbox'
90
+ config.view.maps.bbox_field = 'place_bbox'
91
+ end
69
92
  end
70
93
 
71
- #TODO more tests
72
- end
94
+ before { visit catalog_index_path :q => 'korea', :view => 'maps' }
73
95
 
74
- describe "Sidebar" do
96
+ it "should have 4 markers" do
97
+ expect(find("div.marker-cluster")).to have_content(4)
98
+ end
75
99
 
76
- #TODO more tests
100
+ describe "click marker cluster" do
101
+ before { find("div.marker-cluster").click }
77
102
 
103
+ it "should split into 2 markers" do
104
+ expect(page).to have_selector('div.marker-cluster', count: 2)
105
+ end
106
+ end
78
107
  end
79
- end
108
+ end
@@ -252,7 +252,8 @@
252
252
  - Persian
253
253
  timestamp: '2014-02-03T18:42:53.056Z'
254
254
  placename_coords:
255
- - Iran|32.427908|53.688046
255
+ - Iran-|-32.427908-|-53.688046
256
+ place_bbox: 44.0318907 25.0594286 63.3333366 39.7816755
256
257
  - author_t:
257
258
  - Yoshida, Hajime,
258
259
  - "吉田一"
@@ -335,7 +336,8 @@
335
336
  - Japanese
336
337
  timestamp: '2014-02-03T18:42:53.056Z'
337
338
  placename_coords:
338
- - Japan|36.204824|138.252924
339
+ - Japan-|-36.204824-|-138.252924
340
+ place_bbox: 122.9338302 24.0460446 153.9874305 45.5227719
339
341
  - lc_1letter_facet:
340
342
  - D - World History
341
343
  author_t:
@@ -406,7 +408,8 @@
406
408
  - Russian
407
409
  timestamp: '2014-02-03T18:42:53.056Z'
408
410
  placename_coords:
409
- - Kazakhstan|48.019573|66.923684
411
+ - Kazakhstan-|-48.019573-|-66.923684
412
+ place_bbox: 46.4936719 40.568584 87.315415 55.441984
410
413
  - lc_1letter_facet:
411
414
  - K - Law
412
415
  author_t:
@@ -570,7 +573,8 @@
570
573
  - Korean
571
574
  timestamp: '2014-02-03T18:42:53.056Z'
572
575
  placename_coords:
573
- - Korea|35.907757|127.766922
576
+ - Korea-|-35.907757-|-127.766922
577
+ place_bbox: 124.608139 33.1061096 130.9232178 38.6169312
574
578
  - lc_1letter_facet:
575
579
  - P - Language & Literature
576
580
  author_t:
@@ -702,7 +706,8 @@
702
706
  - Urdu
703
707
  timestamp: '2014-02-03T18:42:53.056Z'
704
708
  placename_coords:
705
- - Pakistan|30.375321|69.34511599999999
709
+ - Pakistan-|-30.375321-|-69.34511599999999
710
+ place_bbox: 60.872972 23.6946945 77.8334694 37.084107
706
711
  - lc_1letter_facet:
707
712
  - M - Music
708
713
  author_t:
@@ -1103,7 +1108,8 @@
1103
1108
  - Korean
1104
1109
  timestamp: '2014-02-03T18:42:53.056Z'
1105
1110
  placename_coords:
1106
- - Korea (North)|35.907757|127.766922
1111
+ - Korea (North)-|-35.907757-|-127.766922
1112
+ place_bbox: 124.608139 33.1061096 130.9232178 38.6169312
1107
1113
  - subtitle_display: ṿe-hu perush yafeh u-menupeh ʻal Shulḥan ʻarukh Oraḥ ḥayim
1108
1114
  asher ḥiber Yosef Ḳaro ... ʻim ḥidushe dinim she-hishmiṭ ha-gaʼon ... ṿe-himtsiʼam
1109
1115
  ... Mosheh Iserlish
@@ -1364,8 +1370,11 @@
1364
1370
  - Korean
1365
1371
  timestamp: '2014-02-03T18:42:53.056Z'
1366
1372
  placename_coords:
1367
- - Seoul (Korea)|37.566535|126.9779692
1368
- - Korea (South)|35.907757|127.766922
1373
+ - Seoul (Korea)-|-37.566535-|-126.9779692
1374
+ - Korea (South)-|-35.907757-|-127.766922
1375
+ place_bbox:
1376
+ - 126.7645827 37.4259627 127.18359 37.7017495
1377
+ - 124.608139 33.1061096 130.9232178 38.6169312
1369
1378
  - subtitle_display: dar khiradvarzī-i siyāsī va huvīyat-i mā Īrānīyān
1370
1379
  author_vern_display: "‏رجايى، فرهنگ ."
1371
1380
  subject_addl_t:
@@ -1475,7 +1484,8 @@
1475
1484
  - Persian
1476
1485
  timestamp: '2014-02-03T18:42:53.056Z'
1477
1486
  placename_coords:
1478
- - Iran|32.427908|53.688046
1487
+ - Iran-|-32.427908-|-53.688046
1488
+ place_bbox: 44.0318907 25.0594286 63.3333366 39.7816755
1479
1489
  - lc_1letter_facet:
1480
1490
  - P - Language & Literature
1481
1491
  author_t:
@@ -1987,7 +1997,8 @@
1987
1997
  - Hebrew
1988
1998
  timestamp: '2014-02-03T18:42:53.056Z'
1989
1999
  placename_coords:
1990
- - Israel|31.046051|34.851612
2000
+ - Israel-|-31.046051-|-34.851612
2001
+ place_bbox: 34.267387 29.47969999999999 35.896244 33.33280500000001
1991
2002
  - lc_1letter_facet:
1992
2003
  - E - History of the Americas (General)
1993
2004
  author_t:
@@ -2097,8 +2108,9 @@
2097
2108
  - 'a Native American elder has her say : an oral history /'
2098
2109
  timestamp: '2014-02-03T18:42:53.056Z'
2099
2110
  placename_coords:
2100
- - New Jersey|40.0583238|-74.4056612
2101
- - Bridgeton|39.427337|-75.2340768
2111
+ - New Jersey-|-40.0583238-|--74.4056612
2112
+ - Bridgeton-|-39.427337-|--75.2340768
2113
+ place_bbox: "-75.25303300000002 39.4027581 -75.20384 39.455303"
2102
2114
  - lc_1letter_facet:
2103
2115
  - B - Philosophy, Psychology, Religion
2104
2116
  author_t:
@@ -2286,7 +2298,8 @@
2286
2298
  - Tibetan
2287
2299
  timestamp: '2014-02-03T18:42:53.056Z'
2288
2300
  placename_coords:
2289
- - India|20.593684|78.96288
2301
+ - India-|-20.593684-|-78.96288
2302
+ place_bbox: 68.162386 6.7535159 97.395555 35.5044752
2290
2303
  - lc_1letter_facet:
2291
2304
  - B - Philosophy, Psychology, Religion
2292
2305
  author_t:
@@ -2446,7 +2459,8 @@
2446
2459
  - Tibetan
2447
2460
  timestamp: '2014-02-03T18:42:53.056Z'
2448
2461
  placename_coords:
2449
- - Tibet (China)|29.646923|91.117212
2462
+ - Tibet (China)-|-29.646923-|-91.117212
2463
+ place_bbox: 78.3955448 26.8548157 99.116241 36.4833345
2450
2464
  - marc_display: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><collection xmlns=\"http://www.loc.gov/MARC21/slim\"><record><leader>01127cam
2451
2465
  a22002895a 4500</leader><controlfield tag=\"001\"> 2008308478</controlfield><controlfield
2452
2466
  tag=\"003\">DLC</controlfield><controlfield tag=\"005\">20090123131001.0</controlfield><controlfield
@@ -2522,9 +2536,11 @@
2522
2536
  - Tibetan
2523
2537
  timestamp: '2014-02-03T18:42:53.056Z'
2524
2538
  placename_coords:
2525
- - China|35.86166|104.195397
2526
- - Tibet|29.646923|91.117212
2527
- - India|20.593684|78.96288
2539
+ - China-|-35.86166-|-104.195397
2540
+ - Tibet-|-29.646923-|-91.117212
2541
+ - India-|-20.593684-|-78.96288
2542
+ - India-|-20.593684-|-78.96288
2543
+ place_bbox: 68.162386 6.7535159 97.395555 35.5044752
2528
2544
  - author_vern_display: "吉田一, 1934-"
2529
2545
  subject_addl_t:
2530
2546
  - 20th century History and criticism
@@ -2631,7 +2647,8 @@
2631
2647
  - Japanese
2632
2648
  timestamp: '2014-02-03T18:42:53.056Z'
2633
2649
  placename_coords:
2634
- - Japan|36.204824|138.252924
2650
+ - Japan-|-36.204824-|-138.252924
2651
+ place_bbox: 122.9338302 24.0460446 153.9874305 45.5227719
2635
2652
  - author_vern_display: "林行止"
2636
2653
  subject_addl_t:
2637
2654
  - 1990-
@@ -2737,6 +2754,7 @@
2737
2754
  - Chinese
2738
2755
  timestamp: '2014-02-03T18:42:53.056Z'
2739
2756
  placename_coords:
2740
- - Economic history|41.3137481|-72.9231485
2741
- - World politics|38.910504|-77.03605999999999
2742
- - Hong Kong (China)|22.396428|114.109497
2757
+ - Economic history-|-41.3137481-|--72.9231485
2758
+ - World politics-|-38.910504-|--77.03605999999999
2759
+ - Hong Kong (China)-|-22.396428-|-114.109497
2760
+ place_bbox: 113.835078 22.1533884 114.4069561 22.561968