simple_solr_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +349 -0
  5. data/Rakefile +11 -0
  6. data/lib/simple_solr.rb +42 -0
  7. data/lib/simple_solr/client.rb +139 -0
  8. data/lib/simple_solr/client/core_admin.rb +0 -0
  9. data/lib/simple_solr/core.rb +50 -0
  10. data/lib/simple_solr/core/admin.rb +47 -0
  11. data/lib/simple_solr/core/core_data.rb +51 -0
  12. data/lib/simple_solr/core/index.rb +25 -0
  13. data/lib/simple_solr/core/search.rb +21 -0
  14. data/lib/simple_solr/response/document.rb +45 -0
  15. data/lib/simple_solr/response/generic_response.rb +19 -0
  16. data/lib/simple_solr/response/query_response.rb +54 -0
  17. data/lib/simple_solr/schema.rb +261 -0
  18. data/lib/simple_solr/schema/analysis.rb +58 -0
  19. data/lib/simple_solr/schema/copyfield.rb +42 -0
  20. data/lib/simple_solr/schema/dynamic_field.rb +23 -0
  21. data/lib/simple_solr/schema/field.rb +35 -0
  22. data/lib/simple_solr/schema/field_or_type.rb +112 -0
  23. data/lib/simple_solr/schema/field_type.rb +62 -0
  24. data/lib/simple_solr/schema/matcher.rb +16 -0
  25. data/lib/simple_solr/version.rb +3 -0
  26. data/simple_solr_client.gemspec +39 -0
  27. data/solr_sample_core/conf/_schema_analysis_stopwords_english.json +38 -0
  28. data/solr_sample_core/conf/_schema_analysis_synonyms_english.json +11 -0
  29. data/solr_sample_core/conf/admin-extra.html +24 -0
  30. data/solr_sample_core/conf/admin-extra.menu-bottom.html +25 -0
  31. data/solr_sample_core/conf/admin-extra.menu-top.html +25 -0
  32. data/solr_sample_core/conf/clustering/carrot2/kmeans-attributes.xml +19 -0
  33. data/solr_sample_core/conf/clustering/carrot2/lingo-attributes.xml +24 -0
  34. data/solr_sample_core/conf/clustering/carrot2/stc-attributes.xml +19 -0
  35. data/solr_sample_core/conf/currency.xml +67 -0
  36. data/solr_sample_core/conf/elevate.xml +38 -0
  37. data/solr_sample_core/conf/lang/contractions_ca.txt +8 -0
  38. data/solr_sample_core/conf/lang/contractions_fr.txt +15 -0
  39. data/solr_sample_core/conf/lang/contractions_ga.txt +5 -0
  40. data/solr_sample_core/conf/lang/contractions_it.txt +23 -0
  41. data/solr_sample_core/conf/lang/hyphenations_ga.txt +5 -0
  42. data/solr_sample_core/conf/lang/stemdict_nl.txt +6 -0
  43. data/solr_sample_core/conf/lang/stoptags_ja.txt +420 -0
  44. data/solr_sample_core/conf/lang/stopwords_ar.txt +125 -0
  45. data/solr_sample_core/conf/lang/stopwords_bg.txt +193 -0
  46. data/solr_sample_core/conf/lang/stopwords_ca.txt +220 -0
  47. data/solr_sample_core/conf/lang/stopwords_ckb.txt +136 -0
  48. data/solr_sample_core/conf/lang/stopwords_cz.txt +172 -0
  49. data/solr_sample_core/conf/lang/stopwords_da.txt +110 -0
  50. data/solr_sample_core/conf/lang/stopwords_de.txt +294 -0
  51. data/solr_sample_core/conf/lang/stopwords_el.txt +78 -0
  52. data/solr_sample_core/conf/lang/stopwords_en.txt +54 -0
  53. data/solr_sample_core/conf/lang/stopwords_es.txt +356 -0
  54. data/solr_sample_core/conf/lang/stopwords_eu.txt +99 -0
  55. data/solr_sample_core/conf/lang/stopwords_fa.txt +313 -0
  56. data/solr_sample_core/conf/lang/stopwords_fi.txt +97 -0
  57. data/solr_sample_core/conf/lang/stopwords_fr.txt +186 -0
  58. data/solr_sample_core/conf/lang/stopwords_ga.txt +110 -0
  59. data/solr_sample_core/conf/lang/stopwords_gl.txt +161 -0
  60. data/solr_sample_core/conf/lang/stopwords_hi.txt +235 -0
  61. data/solr_sample_core/conf/lang/stopwords_hu.txt +211 -0
  62. data/solr_sample_core/conf/lang/stopwords_hy.txt +46 -0
  63. data/solr_sample_core/conf/lang/stopwords_id.txt +359 -0
  64. data/solr_sample_core/conf/lang/stopwords_it.txt +303 -0
  65. data/solr_sample_core/conf/lang/stopwords_ja.txt +127 -0
  66. data/solr_sample_core/conf/lang/stopwords_lv.txt +172 -0
  67. data/solr_sample_core/conf/lang/stopwords_nl.txt +119 -0
  68. data/solr_sample_core/conf/lang/stopwords_no.txt +194 -0
  69. data/solr_sample_core/conf/lang/stopwords_pt.txt +253 -0
  70. data/solr_sample_core/conf/lang/stopwords_ro.txt +233 -0
  71. data/solr_sample_core/conf/lang/stopwords_ru.txt +243 -0
  72. data/solr_sample_core/conf/lang/stopwords_sv.txt +133 -0
  73. data/solr_sample_core/conf/lang/stopwords_th.txt +119 -0
  74. data/solr_sample_core/conf/lang/stopwords_tr.txt +212 -0
  75. data/solr_sample_core/conf/lang/userdict_ja.txt +29 -0
  76. data/solr_sample_core/conf/mapping-FoldToASCII.txt +3813 -0
  77. data/solr_sample_core/conf/mapping-ISOLatin1Accent.txt +246 -0
  78. data/solr_sample_core/conf/protwords.txt +21 -0
  79. data/solr_sample_core/conf/schema.xml +62 -0
  80. data/solr_sample_core/conf/scripts.conf +24 -0
  81. data/solr_sample_core/conf/solrconfig.xml +1702 -0
  82. data/solr_sample_core/conf/spellings.txt +2 -0
  83. data/solr_sample_core/conf/stopwords.txt +14 -0
  84. data/solr_sample_core/conf/syn.txt +0 -0
  85. data/solr_sample_core/conf/synonyms.txt +29 -0
  86. data/solr_sample_core/conf/token_fixing_charfilter.txt +110 -0
  87. data/solr_sample_core/conf/update-script.js +53 -0
  88. data/solr_sample_core/conf/velocity/README.txt +101 -0
  89. data/solr_sample_core/conf/velocity/VM_global_library.vm +175 -0
  90. data/solr_sample_core/conf/velocity/browse.vm +33 -0
  91. data/solr_sample_core/conf/velocity/cluster.vm +19 -0
  92. data/solr_sample_core/conf/velocity/cluster_results.vm +31 -0
  93. data/solr_sample_core/conf/velocity/debug.vm +28 -0
  94. data/solr_sample_core/conf/velocity/did_you_mean.vm +9 -0
  95. data/solr_sample_core/conf/velocity/error.vm +11 -0
  96. data/solr_sample_core/conf/velocity/facet_fields.vm +23 -0
  97. data/solr_sample_core/conf/velocity/facet_pivot.vm +12 -0
  98. data/solr_sample_core/conf/velocity/facet_queries.vm +12 -0
  99. data/solr_sample_core/conf/velocity/facet_ranges.vm +23 -0
  100. data/solr_sample_core/conf/velocity/facets.vm +10 -0
  101. data/solr_sample_core/conf/velocity/footer.vm +43 -0
  102. data/solr_sample_core/conf/velocity/head.vm +35 -0
  103. data/solr_sample_core/conf/velocity/header.vm +7 -0
  104. data/solr_sample_core/conf/velocity/hit.vm +25 -0
  105. data/solr_sample_core/conf/velocity/hit_grouped.vm +43 -0
  106. data/solr_sample_core/conf/velocity/hit_plain.vm +25 -0
  107. data/solr_sample_core/conf/velocity/join_doc.vm +20 -0
  108. data/solr_sample_core/conf/velocity/jquery.autocomplete.css +48 -0
  109. data/solr_sample_core/conf/velocity/jquery.autocomplete.js +763 -0
  110. data/solr_sample_core/conf/velocity/layout.vm +24 -0
  111. data/solr_sample_core/conf/velocity/main.css +230 -0
  112. data/solr_sample_core/conf/velocity/mime_type_lists.vm +68 -0
  113. data/solr_sample_core/conf/velocity/pagination_bottom.vm +22 -0
  114. data/solr_sample_core/conf/velocity/pagination_top.vm +29 -0
  115. data/solr_sample_core/conf/velocity/product_doc.vm +32 -0
  116. data/solr_sample_core/conf/velocity/query.vm +42 -0
  117. data/solr_sample_core/conf/velocity/query_form.vm +64 -0
  118. data/solr_sample_core/conf/velocity/query_group.vm +43 -0
  119. data/solr_sample_core/conf/velocity/query_spatial.vm +75 -0
  120. data/solr_sample_core/conf/velocity/results_list.vm +22 -0
  121. data/solr_sample_core/conf/velocity/richtext_doc.vm +153 -0
  122. data/solr_sample_core/conf/velocity/suggest.vm +8 -0
  123. data/solr_sample_core/conf/velocity/tabs.vm +50 -0
  124. data/solr_sample_core/conf/xslt/example.xsl +132 -0
  125. data/solr_sample_core/conf/xslt/example_atom.xsl +67 -0
  126. data/solr_sample_core/conf/xslt/example_rss.xsl +66 -0
  127. data/solr_sample_core/conf/xslt/luke.xsl +337 -0
  128. data/solr_sample_core/conf/xslt/updateXml.xsl +70 -0
  129. data/spec/client_basics_spec.rb +26 -0
  130. data/spec/connect_spec.rb +25 -0
  131. data/spec/core_basics.rb +21 -0
  132. data/spec/index_spec.rb +31 -0
  133. data/spec/load_spec.rb +7 -0
  134. data/spec/minitest_helper.rb +36 -0
  135. data/spec/schema_spec.rb +113 -0
  136. metadata +284 -0
@@ -0,0 +1,64 @@
1
+ #**
2
+ * Renders the main query form
3
+ *#
4
+
5
+ <div class="query-box">
6
+ <form id="query-form" action="#{url_for_home}" method="GET">
7
+
8
+ <div class="inputs">
9
+ <span #annTitle("Add the query using the &q= parameter")>
10
+ Find:
11
+ <input type="text" id="q" name="q" value="$!esc.html($params.get('q'))"/>
12
+ <input type="submit" id="querySubmit"/>
13
+ <input type="reset"/>
14
+ </span>
15
+ <div class="query-boost">
16
+ <span #annTitle("Add the boost function &bf=price to the query")>
17
+ <input type="checkbox" name="bf" value="price"
18
+ #if($request.params.get('bf') == 'price')checked="true"#end
19
+ >
20
+ Boost by Price
21
+ </input>
22
+ </span>
23
+ #parse("query_spatial.vm")
24
+ #parse("query_group.vm")
25
+ </div>
26
+ </div>
27
+
28
+ #if($request.params.get('debugQuery'))
29
+ <input type="hidden" name="debugQuery" value="true"/>
30
+ #end
31
+ #if($annotate == true)
32
+ <input type="hidden" name="annotateBrowse" value="true"/>
33
+ #end
34
+ #foreach($fq in $request.params.getParams('fq'))
35
+ #if ($fq != "{!bbox}")
36
+ <input type="hidden" name="fq" id="allFQs" value="$esc.html($fq)"/>
37
+ #end
38
+ #end
39
+
40
+ <div class="constraints" #annTitle("Lists out the &fq filters. Click to remove.")>
41
+ #foreach($fq in $params.getParams('fq'))
42
+ #set($previous_fq_count=$velocityCount - 1)
43
+ #if($fq != '')
44
+ &gt;
45
+ <a style="{text-decoration: line-through;}"
46
+ href="#url_for_filters($request.params.getParams('fq').subList(0,$previous_fq_count))"
47
+ >$fq</a>
48
+ #end
49
+ #end
50
+ </div>
51
+
52
+ <div class="parsed_query_header">
53
+ #if($request.params.get('debugQuery'))
54
+ <a href="#" onclick='jQuery(this).siblings("div").toggle(); return false;'>toggle parsed query</a>
55
+ <div class="parsed_query" style="display:none">$response.response.debug.parsedquery</div>
56
+ #end
57
+ #set($queryOpts = $request.params.get("queryOpts"))
58
+ #if($queryOpts && $queryOpts != "")
59
+ <input type="hidden" name="queryOpts" value="$queryOpts"/>
60
+ #end
61
+ </div>
62
+
63
+ </form>
64
+ </div>
@@ -0,0 +1,43 @@
1
+ #**
2
+ * Query settings for grouping by fields,
3
+ * e.g.: Manufacturer or Popularity
4
+ *#
5
+
6
+ #set($queryOpts = $params.get("queryOpts"))
7
+
8
+ #if($queryOpts == "group")
9
+ <div>
10
+ #set($groupF = $request.params.get('group.field'))
11
+
12
+ <label #annTitle("Add the &group.field parameter. Multiselect is supported")>
13
+ Group By:
14
+ <select id="group" name="group.field" multiple="true">
15
+ ## TODO: Handle multiple selects correctly
16
+ ## TODO: fix empty / "No Group" selection
17
+
18
+ <option value=""
19
+ #if($groupF == '')selected="true"#end
20
+ >
21
+ No Group
22
+ </option>
23
+
24
+ <option value="manu_exact"
25
+ #if($groupF == 'manu_exact')selected="true"#end
26
+ >
27
+ Manufacturer
28
+ </option>
29
+
30
+ <option value="popularity"
31
+ #if($groupF == 'popularity')selected="true"#end
32
+ >
33
+ Popularity
34
+ </option>
35
+
36
+ </select>
37
+ </label>
38
+
39
+ <input type="hidden" name="group" value="true"/>
40
+
41
+ </div>
42
+
43
+ #end
@@ -0,0 +1,75 @@
1
+ #**
2
+ * Query logic for selecting location / Geospatial search
3
+ *#
4
+
5
+ #set($queryOpts = $params.get("queryOpts"))
6
+
7
+ #if($queryOpts == "spatial")
8
+
9
+ <div>
10
+
11
+ #set($loc = $request.params.get('pt'))
12
+ ## Normalize first trip through to "none" because
13
+ ## an empty string generates an error message later on
14
+ #if( ! $loc )
15
+ #set( $loc = "none" )
16
+ #end
17
+
18
+ #set($dist = $request.params.get('d', "10"))
19
+
20
+ ## Cities for The Select List
21
+ #set( $cities = {
22
+ "none": "No Filter",
23
+ "45.17614,-93.87341": "Buffalo, MN",
24
+ "37.7752,-100.0232": "Dodge City, KS",
25
+ "35.0752,-97.032": "Oklahoma City, OK",
26
+ "37.7752,-122.4232": "San Francisco CA"
27
+ })
28
+
29
+ <label #annTitle("Add the &pt parameter")>
30
+ Location Filter:
31
+ <select id="pt" name="pt">
32
+
33
+ ## Generate <option> tag for each city
34
+ #foreach( $city_lon_lat in $cities.keySet() )
35
+ #set( $city_name = $cities.get($city_lon_lat) )
36
+ <option value="$city_lon_lat"
37
+ #if($loc == $city_lon_lat)selected="true"#end
38
+ >
39
+ $city_name
40
+ </option>
41
+ #end
42
+
43
+ </select>
44
+
45
+ </label>
46
+
47
+ <span #annTitle("Add the &d parameter")>
48
+ Distance (KM):
49
+ <input id="d" name="d" type="text" size="6"
50
+ value="#if($dist != '')${dist}#{else}10#end" ## TODO: isn't the default of 10 above sufficient? no if/else needed?
51
+ />
52
+ </span>
53
+
54
+ <input type="hidden" name="sfield" value="store"/>
55
+ <input type="hidden" id="spatialFQ" name="fq" value=""/>
56
+ <input type="hidden" name="queryOpts" value="spatial"/>
57
+
58
+ </div>
59
+
60
+ <script type="text/javascript">
61
+ $('#query-form').submit(function() {
62
+ if ($("#pt").val() != "none") {
63
+ $("#spatialFQ").val("{!bbox}");
64
+ }
65
+ $fqs = $("#allFQs").val();
66
+ $fqs = $fqs.replace("{!bbox}", "");
67
+ if ($fqs == ''){
68
+ $("#allFQs").remove();
69
+ }
70
+ $("#allFQs").val($fqs);
71
+ return true;
72
+ });
73
+ </script>
74
+
75
+ #end
@@ -0,0 +1,22 @@
1
+ #**
2
+ * Render the main Results List
3
+ *#
4
+
5
+ ## Usually displayed inside <div class="results">
6
+
7
+ #if($response.response.get('grouped'))
8
+
9
+ #foreach($grouping in $response.response.get('grouped'))
10
+ #parse("hit_grouped.vm")
11
+ #end
12
+
13
+ #else
14
+
15
+ #foreach($doc in $response.results)
16
+ #parse("hit.vm")
17
+ ## Can get an extremely simple view of the doc
18
+ ## which might be nicer for debugging
19
+ ##parse("hit_plain.vm")
20
+ #end
21
+
22
+ #end
@@ -0,0 +1,153 @@
1
+ #**
2
+ * Render a complex document in the results list
3
+ *#
4
+
5
+ ## Load Mime-Type List and Mapping
6
+ #parse('mime_type_lists.vm')
7
+ ## Sets:
8
+ ## * supportedMimeTypes, AKA supportedtypes
9
+ ## * mimeExtensionsMap, AKA extMap
10
+
11
+ ## Title
12
+ #if($doc.getFieldValue('title'))
13
+ #set($title = $esc.html($doc.getFirstValue('title')))
14
+ #else
15
+ #set($title = "["+$doc.getFieldValue('id')+"]")
16
+ #end
17
+
18
+ ## URL
19
+ #if($doc.getFieldValue('url'))
20
+ #set($url = $doc.getFieldValue('url'))
21
+ #elseif($doc.getFieldValue('resourcename'))
22
+ #set($url = "file:///$doc.getFieldValue('resourcename')")
23
+ #else
24
+ #set($url = "$doc.getFieldValue('id')")
25
+ #end
26
+
27
+ ## Sort out Mime-Type
28
+ #set($ct = $list.get($doc.getFirstValue('content_type').split(";"),0))
29
+ #set($filename = $doc.getFieldValue('resourcename'))
30
+ #set($filetype = false)
31
+ #set($filetype = $mimeExtensionsMap.get($ct))
32
+
33
+ ## TODO: falling back to file extension is convenient,
34
+ ## except when you don't have an icon for that extension
35
+ ## example "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
36
+ ## document with a .docx extension.
37
+ ## It'd be nice to fall back to an "unknown" or the existing "file" type
38
+ ## We sort of do this below, but only if the filename has no extension
39
+ ## (anything after the last dot).
40
+
41
+ #if(!$filetype)
42
+ #set($filetype = $filename.substring($filename.lastIndexOf(".")).substring(1))
43
+ #end
44
+
45
+ ## #if(!$filetype)
46
+ ## #set($filetype = "file")
47
+ ## #end
48
+ ## #if(!$supportedMimeTypes.contains($filetype))
49
+ ## #set($filetype = "file")
50
+ ## #end
51
+
52
+ ## Row 1: Icon and Title and mlt link
53
+ <div class="result-title">
54
+ ## Icon
55
+ ## Small file type icons from http://www.splitbrain.org/projects/file_icons (public domain)
56
+ <img src="#{url_root}/img/filetypes/${filetype}.png" align="center">
57
+
58
+ ## Title, hyperlinked
59
+ <a href="${url}" target="_blank">
60
+ <b>$title</b></a>
61
+
62
+ ## Link for MLT / More Like This / Find Similar
63
+ <span class="mlt">
64
+ #if($params.getBool('mlt', false) == false)
65
+ <a href="#lensNoQ&q=id:%22$docId%22&mlt=true">
66
+ More Like This</a>
67
+ #end
68
+ </span>
69
+
70
+ </div>
71
+
72
+ ## Row 2?: ID / URL
73
+ <div>
74
+ Id: #field('id')
75
+ </div>
76
+
77
+ ## Resource Name
78
+ <div>
79
+ #if($doc.getFieldValue('resourcename'))
80
+ Resource name: $filename
81
+ #elseif($url)
82
+ URL: $url
83
+ #end
84
+ #if($ct)
85
+ ($ct)
86
+ #end
87
+ </div>
88
+
89
+ ## Author
90
+ #if($doc.getFieldValue('author'))
91
+ <div>
92
+ Author: #field('author')
93
+ </div>
94
+ #end
95
+
96
+ ## Last_Modified Date
97
+ #if($doc.getFieldValue('last_modified'))
98
+ <div>
99
+ last-modified:
100
+ #field('last_modified')
101
+ </div>
102
+ #end
103
+
104
+ ## Main content of doc
105
+ <div class="result-body">
106
+ #field('content')
107
+ </div>
108
+
109
+ ## Display Similar Documents / MLT = More Like This
110
+ <div class="mlt">
111
+ #set($mlt = $mltResults.get($docId))
112
+ #set($mltOn = $params.getBool('mlt'))
113
+ #if($mltOn == true)
114
+ <div class="field-name">
115
+ Similar Items
116
+ </div>
117
+ #end
118
+ ## If has MLT enabled An Entries to show
119
+ #if ($mltOn && $mlt && $mlt.size() > 0)
120
+ <ul>
121
+ #foreach($mltHit in $mlt)
122
+ #set($mltId = $mltHit.getFieldValue('id'))
123
+ <li>
124
+ <div>
125
+ <a href="#url_for_home?q=id:$mltId">
126
+ $mltId</a>
127
+ </div>
128
+ <div>
129
+ <span class="field-name">
130
+ Title:
131
+ </span>
132
+ $mltHit.getFieldValue('title')
133
+ </div>
134
+ <div>
135
+ <span class="field-name">
136
+ Author:
137
+ </span>
138
+ $mltHit.getFieldValue('author')
139
+ <span class="field-name">
140
+ Description:
141
+ </span>
142
+ $mltHit.getFieldValue('description')
143
+ </div>
144
+ </li>
145
+ #end ## end for each mltHit in $mlt
146
+ </ul>
147
+ ## Else MLT Enabled but no mlt results for this query
148
+ #elseif($mltOn && $mlt.size() == 0)
149
+ <div>No Similar Items Found</div>
150
+ #end
151
+ </div> ## div class=mlt
152
+
153
+ #parse('debug.vm')
@@ -0,0 +1,8 @@
1
+ #**
2
+ * Provides cynamic spelling suggestions
3
+ * as you type in the search form
4
+ *#
5
+
6
+ #foreach($t in $response.response.terms.name)
7
+ $t.key
8
+ #end
@@ -0,0 +1,50 @@
1
+ #**
2
+ * Provides navigation/access to Advanced search options
3
+ * Usually displayed near the top of the page
4
+ *#
5
+
6
+ ##TODO: Make some nice tabs here
7
+
8
+ #set($queryOpts = $params.get("queryOpts"))
9
+
10
+ <div class="tabs-bar" #annTitle("Click the link to demonstrate various Solr capabilities")>
11
+
12
+ <span>Type of Search:</span>
13
+
14
+ ##queryOpts=$queryOpts
15
+
16
+ ## return to Simple Search
17
+ ##set( $selected = ($queryOpts && $queryOpts != "") )
18
+ #set( $selected = ! $queryOpts )
19
+ <span class="tab #if($selected)selected#end">
20
+ #if($selected)
21
+ Simple
22
+ #else
23
+ <a href="#url_for_home/?#debug#annotate">
24
+ Simple</a>
25
+ #end
26
+ </span>
27
+
28
+ ## GEO-Spatial / Location Based
29
+ #set( $selected = ($queryOpts == "spatial") )
30
+ <span class="tab #if($selected)selected#end">
31
+ #if($selected)
32
+ Spatial
33
+ #else
34
+ <a href="#url_for_home?&queryOpts=spatial#debug#annotate">
35
+ Spatial</a>
36
+ #end
37
+ </span>
38
+
39
+ ## Group By Field
40
+ #set( $selected = ($queryOpts == "group") )
41
+ <span class="tab #if($selected)selected#end">
42
+ #if($selected)
43
+ Group By
44
+ #else
45
+ <a href="#url_for_home?#debug#annotate&queryOpts=group&group=true&group.field=manu_exact">
46
+ Group By</a>
47
+ #end
48
+ </span>
49
+
50
+ </div>
@@ -0,0 +1,132 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+
3
+ <!--
4
+ * Licensed to the Apache Software Foundation (ASF) under one or more
5
+ * contributor license agreements. See the NOTICE file distributed with
6
+ * this work for additional information regarding copyright ownership.
7
+ * The ASF licenses this file to You under the Apache License, Version 2.0
8
+ * (the "License"); you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ -->
19
+
20
+ <!--
21
+ Simple transform of Solr query results to HTML
22
+ -->
23
+ <xsl:stylesheet version='1.0'
24
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
25
+ >
26
+
27
+ <xsl:output media-type="text/html" encoding="UTF-8"/>
28
+
29
+ <xsl:variable name="title" select="concat('Solr search results (',response/result/@numFound,' documents)')"/>
30
+
31
+ <xsl:template match='/'>
32
+ <html>
33
+ <head>
34
+ <title><xsl:value-of select="$title"/></title>
35
+ <xsl:call-template name="css"/>
36
+ </head>
37
+ <body>
38
+ <h1><xsl:value-of select="$title"/></h1>
39
+ <div class="note">
40
+ This has been formatted by the sample "example.xsl" transform -
41
+ use your own XSLT to get a nicer page
42
+ </div>
43
+ <xsl:apply-templates select="response/result/doc"/>
44
+ </body>
45
+ </html>
46
+ </xsl:template>
47
+
48
+ <xsl:template match="doc">
49
+ <xsl:variable name="pos" select="position()"/>
50
+ <div class="doc">
51
+ <table width="100%">
52
+ <xsl:apply-templates>
53
+ <xsl:with-param name="pos"><xsl:value-of select="$pos"/></xsl:with-param>
54
+ </xsl:apply-templates>
55
+ </table>
56
+ </div>
57
+ </xsl:template>
58
+
59
+ <xsl:template match="doc/*[@name='score']" priority="100">
60
+ <xsl:param name="pos"></xsl:param>
61
+ <tr>
62
+ <td class="name">
63
+ <xsl:value-of select="@name"/>
64
+ </td>
65
+ <td class="value">
66
+ <xsl:value-of select="."/>
67
+
68
+ <xsl:if test="boolean(//lst[@name='explain'])">
69
+ <xsl:element name="a">
70
+ <!-- can't allow whitespace here -->
71
+ <xsl:attribute name="href">javascript:toggle("<xsl:value-of select="concat('exp-',$pos)" />");</xsl:attribute>?</xsl:element>
72
+ <br/>
73
+ <xsl:element name="div">
74
+ <xsl:attribute name="class">exp</xsl:attribute>
75
+ <xsl:attribute name="id">
76
+ <xsl:value-of select="concat('exp-',$pos)" />
77
+ </xsl:attribute>
78
+ <xsl:value-of select="//lst[@name='explain']/str[position()=$pos]"/>
79
+ </xsl:element>
80
+ </xsl:if>
81
+ </td>
82
+ </tr>
83
+ </xsl:template>
84
+
85
+ <xsl:template match="doc/arr" priority="100">
86
+ <tr>
87
+ <td class="name">
88
+ <xsl:value-of select="@name"/>
89
+ </td>
90
+ <td class="value">
91
+ <ul>
92
+ <xsl:for-each select="*">
93
+ <li><xsl:value-of select="."/></li>
94
+ </xsl:for-each>
95
+ </ul>
96
+ </td>
97
+ </tr>
98
+ </xsl:template>
99
+
100
+
101
+ <xsl:template match="doc/*">
102
+ <tr>
103
+ <td class="name">
104
+ <xsl:value-of select="@name"/>
105
+ </td>
106
+ <td class="value">
107
+ <xsl:value-of select="."/>
108
+ </td>
109
+ </tr>
110
+ </xsl:template>
111
+
112
+ <xsl:template match="*"/>
113
+
114
+ <xsl:template name="css">
115
+ <script>
116
+ function toggle(id) {
117
+ var obj = document.getElementById(id);
118
+ obj.style.display = (obj.style.display != 'block') ? 'block' : 'none';
119
+ }
120
+ </script>
121
+ <style type="text/css">
122
+ body { font-family: "Lucida Grande", sans-serif }
123
+ td.name { font-style: italic; font-size:80%; }
124
+ td { vertical-align: top; }
125
+ ul { margin: 0px; margin-left: 1em; padding: 0px; }
126
+ .note { font-size:80%; }
127
+ .doc { margin-top: 1em; border-top: solid grey 1px; }
128
+ .exp { display: none; font-family: monospace; white-space: pre; }
129
+ </style>
130
+ </xsl:template>
131
+
132
+ </xsl:stylesheet>