rere 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/.classpath +260 -0
  2. data/.gitignore +28 -0
  3. data/.project +14 -0
  4. data/.ruby-version +1 -0
  5. data/.settings/org.eclim.prefs +3 -0
  6. data/.settings/org.eclipse.jdt.core.prefs +5 -0
  7. data/.settings/org.eclipse.jdt.ui.prefs +2 -0
  8. data/Gemfile +7 -0
  9. data/LICENSE +22 -0
  10. data/README.md +44 -0
  11. data/Rakefile +65 -0
  12. data/bin/solr +61 -0
  13. data/example/config/solr.yml +23 -0
  14. data/example/log/.gitkeep +0 -0
  15. data/example/solr/README.txt +63 -0
  16. data/example/solr/collection1/README.txt +50 -0
  17. data/example/solr/collection1/conf/admin-extra.html +24 -0
  18. data/example/solr/collection1/conf/admin-extra.menu-bottom.html +25 -0
  19. data/example/solr/collection1/conf/admin-extra.menu-top.html +25 -0
  20. data/example/solr/collection1/conf/currency.xml +67 -0
  21. data/example/solr/collection1/conf/elevate.xml +38 -0
  22. data/example/solr/collection1/conf/lang/contractions_ca.txt +8 -0
  23. data/example/solr/collection1/conf/lang/contractions_fr.txt +15 -0
  24. data/example/solr/collection1/conf/lang/contractions_ga.txt +5 -0
  25. data/example/solr/collection1/conf/lang/contractions_it.txt +23 -0
  26. data/example/solr/collection1/conf/lang/hyphenations_ga.txt +5 -0
  27. data/example/solr/collection1/conf/lang/stemdict_nl.txt +6 -0
  28. data/example/solr/collection1/conf/lang/stoptags_ja.txt +420 -0
  29. data/example/solr/collection1/conf/lang/stopwords_ar.txt +125 -0
  30. data/example/solr/collection1/conf/lang/stopwords_bg.txt +193 -0
  31. data/example/solr/collection1/conf/lang/stopwords_ca.txt +220 -0
  32. data/example/solr/collection1/conf/lang/stopwords_cz.txt +172 -0
  33. data/example/solr/collection1/conf/lang/stopwords_da.txt +108 -0
  34. data/example/solr/collection1/conf/lang/stopwords_de.txt +292 -0
  35. data/example/solr/collection1/conf/lang/stopwords_el.txt +78 -0
  36. data/example/solr/collection1/conf/lang/stopwords_en.txt +54 -0
  37. data/example/solr/collection1/conf/lang/stopwords_es.txt +354 -0
  38. data/example/solr/collection1/conf/lang/stopwords_eu.txt +99 -0
  39. data/example/solr/collection1/conf/lang/stopwords_fa.txt +313 -0
  40. data/example/solr/collection1/conf/lang/stopwords_fi.txt +95 -0
  41. data/example/solr/collection1/conf/lang/stopwords_fr.txt +184 -0
  42. data/example/solr/collection1/conf/lang/stopwords_ga.txt +110 -0
  43. data/example/solr/collection1/conf/lang/stopwords_gl.txt +161 -0
  44. data/example/solr/collection1/conf/lang/stopwords_hi.txt +235 -0
  45. data/example/solr/collection1/conf/lang/stopwords_hu.txt +209 -0
  46. data/example/solr/collection1/conf/lang/stopwords_hy.txt +46 -0
  47. data/example/solr/collection1/conf/lang/stopwords_id.txt +359 -0
  48. data/example/solr/collection1/conf/lang/stopwords_it.txt +301 -0
  49. data/example/solr/collection1/conf/lang/stopwords_ja.txt +127 -0
  50. data/example/solr/collection1/conf/lang/stopwords_lv.txt +172 -0
  51. data/example/solr/collection1/conf/lang/stopwords_nl.txt +117 -0
  52. data/example/solr/collection1/conf/lang/stopwords_no.txt +192 -0
  53. data/example/solr/collection1/conf/lang/stopwords_pt.txt +251 -0
  54. data/example/solr/collection1/conf/lang/stopwords_ro.txt +233 -0
  55. data/example/solr/collection1/conf/lang/stopwords_ru.txt +241 -0
  56. data/example/solr/collection1/conf/lang/stopwords_sv.txt +131 -0
  57. data/example/solr/collection1/conf/lang/stopwords_th.txt +119 -0
  58. data/example/solr/collection1/conf/lang/stopwords_tr.txt +212 -0
  59. data/example/solr/collection1/conf/lang/userdict_ja.txt +29 -0
  60. data/example/solr/collection1/conf/mapping-FoldToASCII.txt +3813 -0
  61. data/example/solr/collection1/conf/mapping-ISOLatin1Accent.txt +246 -0
  62. data/example/solr/collection1/conf/protwords.txt +21 -0
  63. data/example/solr/collection1/conf/schema.xml +1125 -0
  64. data/example/solr/collection1/conf/scripts.conf +24 -0
  65. data/example/solr/collection1/conf/solrconfig.xml +1816 -0
  66. data/example/solr/collection1/conf/spellings.txt +2 -0
  67. data/example/solr/collection1/conf/stopwords.txt +14 -0
  68. data/example/solr/collection1/conf/synonyms.txt +29 -0
  69. data/example/solr/collection1/conf/update-script.js +53 -0
  70. data/example/solr/collection1/conf/velocity/VM_global_library.vm +170 -0
  71. data/example/solr/collection1/conf/velocity/browse.vm +50 -0
  72. data/example/solr/collection1/conf/velocity/cluster.vm +9 -0
  73. data/example/solr/collection1/conf/velocity/clusterResults.vm +12 -0
  74. data/example/solr/collection1/conf/velocity/debug.vm +17 -0
  75. data/example/solr/collection1/conf/velocity/did_you_mean.vm +4 -0
  76. data/example/solr/collection1/conf/velocity/facet_fields.vm +15 -0
  77. data/example/solr/collection1/conf/velocity/facet_pivot.vm +3 -0
  78. data/example/solr/collection1/conf/velocity/facet_queries.vm +3 -0
  79. data/example/solr/collection1/conf/velocity/facet_ranges.vm +15 -0
  80. data/example/solr/collection1/conf/velocity/facets.vm +5 -0
  81. data/example/solr/collection1/conf/velocity/footer.vm +17 -0
  82. data/example/solr/collection1/conf/velocity/head.vm +32 -0
  83. data/example/solr/collection1/conf/velocity/header.vm +3 -0
  84. data/example/solr/collection1/conf/velocity/hit.vm +11 -0
  85. data/example/solr/collection1/conf/velocity/hitGrouped.vm +24 -0
  86. data/example/solr/collection1/conf/velocity/join-doc.vm +4 -0
  87. data/example/solr/collection1/conf/velocity/jquery.autocomplete.css +48 -0
  88. data/example/solr/collection1/conf/velocity/jquery.autocomplete.js +763 -0
  89. data/example/solr/collection1/conf/velocity/layout.vm +20 -0
  90. data/example/solr/collection1/conf/velocity/main.css +208 -0
  91. data/example/solr/collection1/conf/velocity/product-doc.vm +27 -0
  92. data/example/solr/collection1/conf/velocity/query.vm +42 -0
  93. data/example/solr/collection1/conf/velocity/queryGroup.vm +19 -0
  94. data/example/solr/collection1/conf/velocity/querySpatial.vm +40 -0
  95. data/example/solr/collection1/conf/velocity/richtext-doc.vm +114 -0
  96. data/example/solr/collection1/conf/velocity/suggest.vm +3 -0
  97. data/example/solr/collection1/conf/velocity/tabs.vm +6 -0
  98. data/example/solr/collection1/conf/xslt/example.xsl +132 -0
  99. data/example/solr/collection1/conf/xslt/example_atom.xsl +67 -0
  100. data/example/solr/collection1/conf/xslt/example_rss.xsl +66 -0
  101. data/example/solr/collection1/conf/xslt/luke.xsl +337 -0
  102. data/example/solr/collection1/conf/xslt/updateXml.xsl +70 -0
  103. data/example/solr/collection1/data/index/segments.gen +0 -0
  104. data/example/solr/collection1/data/index/segments_1 +0 -0
  105. data/example/solr/data/development/index/segments.gen +0 -0
  106. data/example/solr/data/development/index/segments_1 +0 -0
  107. data/example/solr/solr.xml +53 -0
  108. data/example/solr/zoo.cfg +17 -0
  109. data/lib/rere.rb +66 -0
  110. data/lib/rere/railtie.rb +8 -0
  111. data/lib/rere/server.rb +380 -0
  112. data/lib/rere/tasks/solr.rake +47 -0
  113. data/lib/rere/version.rb +3 -0
  114. data/pom.xml +168 -0
  115. data/rere.gemspec +26 -0
  116. data/server/README.txt +78 -0
  117. data/server/cloud-scripts/zkcli.bat +12 -0
  118. data/server/cloud-scripts/zkcli.sh +14 -0
  119. data/server/contexts/solr-jetty-context.xml +8 -0
  120. data/server/etc/create-solrtest.keystore.sh +37 -0
  121. data/server/etc/jetty.xml +205 -0
  122. data/server/etc/logging.properties +38 -0
  123. data/server/etc/solrtest.keystore +0 -0
  124. data/server/etc/webdefault.xml +527 -0
  125. data/server/exampledocs/books.csv +11 -0
  126. data/server/exampledocs/books.json +51 -0
  127. data/server/exampledocs/gb18030-example.xml +32 -0
  128. data/server/exampledocs/hd.xml +56 -0
  129. data/server/exampledocs/ipod_other.xml +60 -0
  130. data/server/exampledocs/ipod_video.xml +40 -0
  131. data/server/exampledocs/manufacturers.xml +75 -0
  132. data/server/exampledocs/mem.xml +77 -0
  133. data/server/exampledocs/money.xml +65 -0
  134. data/server/exampledocs/monitor.xml +35 -0
  135. data/server/exampledocs/monitor2.xml +34 -0
  136. data/server/exampledocs/mp500.xml +43 -0
  137. data/server/exampledocs/post.jar +0 -0
  138. data/server/exampledocs/post.sh +30 -0
  139. data/server/exampledocs/sd500.xml +38 -0
  140. data/server/exampledocs/solr.xml +38 -0
  141. data/server/exampledocs/test_utf8.sh +93 -0
  142. data/server/exampledocs/utf8-example.xml +42 -0
  143. data/server/exampledocs/vidcard.xml +62 -0
  144. data/server/lib/ext/jcl-over-slf4j-1.6.6.jar +0 -0
  145. data/server/lib/ext/jul-to-slf4j-1.6.6.jar +0 -0
  146. data/server/lib/ext/log4j-1.2.16.jar +0 -0
  147. data/server/lib/ext/slf4j-api-1.6.6.jar +0 -0
  148. data/server/lib/ext/slf4j-log4j12-1.6.6.jar +0 -0
  149. data/server/lib/jetty-continuation-8.1.8.v20121106.jar +0 -0
  150. data/server/lib/jetty-deploy-8.1.8.v20121106.jar +0 -0
  151. data/server/lib/jetty-http-8.1.8.v20121106.jar +0 -0
  152. data/server/lib/jetty-io-8.1.8.v20121106.jar +0 -0
  153. data/server/lib/jetty-jmx-8.1.8.v20121106.jar +0 -0
  154. data/server/lib/jetty-security-8.1.8.v20121106.jar +0 -0
  155. data/server/lib/jetty-server-8.1.8.v20121106.jar +0 -0
  156. data/server/lib/jetty-servlet-8.1.8.v20121106.jar +0 -0
  157. data/server/lib/jetty-util-8.1.8.v20121106.jar +0 -0
  158. data/server/lib/jetty-webapp-8.1.8.v20121106.jar +0 -0
  159. data/server/lib/jetty-xml-8.1.8.v20121106.jar +0 -0
  160. data/server/lib/servlet-api-3.0.jar +0 -0
  161. data/server/resources/log4j.properties +19 -0
  162. data/server/solr/README.txt +63 -0
  163. data/server/solr/solr.xml +53 -0
  164. data/server/solr/zoo.cfg +17 -0
  165. data/server/start.jar +0 -0
  166. data/server/webapps/solr.war +0 -0
  167. data/solr/lib/solr-winds-0.1.jar +0 -0
  168. metadata +284 -0
@@ -0,0 +1,20 @@
1
+ <html>
2
+ <head>
3
+ #parse("head.vm")
4
+ </head>
5
+ <body>
6
+ <div id="admin"><a href="#url_root/#/#core_name">Solr Admin</a></div>
7
+ <div id="header">
8
+ #parse("header.vm")
9
+ </div>
10
+ <div id="tabs">
11
+ #parse("tabs.vm")
12
+ </div>
13
+ <div id="content">
14
+ $content
15
+ </div>
16
+ <div id="footer">
17
+ #parse("footer.vm")
18
+ </div>
19
+ </body>
20
+ </html>
@@ -0,0 +1,208 @@
1
+ #admin{
2
+ text-align: right;
3
+ vertical-align: top;
4
+ }
5
+
6
+ #head{
7
+ width: 100%;
8
+ }
9
+ .array-field {
10
+ border: 2px solid #474747;
11
+ background: #FFE9D8;
12
+ padding: 5px;
13
+ margin: 5px;
14
+ }
15
+
16
+ .array-field-list li {
17
+ list-style: circle;
18
+ margin-left: 20px;
19
+ }
20
+
21
+ .parsed_query_header {
22
+ font-family: Helvetica, Arial, sans-serif;
23
+ font-size: 10pt;
24
+ font-weight: bold;
25
+ }
26
+
27
+ .parsed_query {
28
+ font-family: Courier, Courier New, monospaced;
29
+ font-size: 10pt;
30
+ font-weight: normal;
31
+ }
32
+
33
+ body {
34
+ font-family: Helvetica, Arial, sans-serif;
35
+ font-size: 10pt;
36
+ }
37
+
38
+ a {
39
+ color: #43a4b1;
40
+ }
41
+
42
+ .navigators {
43
+ float: left;
44
+ margin: 5px;
45
+ margin-top: 0px;
46
+ width: 185px;
47
+ padding: 5px;
48
+ top: -20px;
49
+ position: relative;
50
+ }
51
+
52
+ .navigators h2 {
53
+ background: #FEC293;
54
+ border: 1px solid #ce9d77;
55
+ padding: 5px;
56
+ }
57
+
58
+ .navigators ul {
59
+ list-style: none;
60
+ margin: 0;
61
+ margin-bottom: 5px;
62
+ margin-top: 5px;
63
+ padding-left: 10px;
64
+ }
65
+
66
+ .navigators ul li {
67
+ color: #999;
68
+ padding: 2px;
69
+ }
70
+
71
+
72
+
73
+ .facet-field {
74
+ font-weight: bold;
75
+ }
76
+
77
+ .highlight {
78
+ color: white;
79
+ background-color: gray;
80
+ border: 1px black solid;
81
+ }
82
+
83
+ .highlight-box {
84
+ margin-left: 15px;
85
+ }
86
+
87
+ .field-name {
88
+ font-weight: bold;
89
+ }
90
+
91
+ .highlighted-facet-field {
92
+ background: white;
93
+ }
94
+
95
+ .constraints {
96
+ margin-top: 10px;
97
+ }
98
+
99
+ #query-form{
100
+ width: 80%;
101
+ }
102
+
103
+
104
+
105
+ .query-box, .constraints {
106
+ padding: 5px;
107
+ margin: 5px;
108
+ font-weight: normal;
109
+ font-size: 24px;
110
+ letter-spacing: 0.08em;
111
+ }
112
+
113
+ .query-box #q {
114
+ margin-left: 8px;
115
+ width: 60%;
116
+ height: 50px;
117
+ border: 1px solid #999;
118
+ font-size: 1em;
119
+ padding: 0.4em;
120
+ }
121
+
122
+ .query-box {
123
+
124
+ }
125
+
126
+ .query-boost {
127
+
128
+ top: 10px;
129
+ left: 50px;
130
+ position: relative;
131
+ font-size: 0.8em;
132
+ }
133
+
134
+ .query-box .inputs{
135
+ left: 180px;
136
+ position: relative;
137
+
138
+ }
139
+
140
+ #logo {
141
+ margin: 10px;
142
+ border-style: none;
143
+ }
144
+
145
+ .pagination {
146
+ padding-left: 33%;
147
+ background: #eee;
148
+ margin: 5px;
149
+ margin-left: 210px;
150
+ padding-top: 5px;
151
+ padding-bottom: 5px;
152
+ }
153
+
154
+ .result-document {
155
+ border: 1px solid #999;
156
+ padding: 5px;
157
+ margin: 5px;
158
+ margin-left: 210px;
159
+ margin-bottom: 15px;
160
+ }
161
+
162
+ .result-document div{
163
+ padding: 5px;
164
+ }
165
+
166
+ .result-title{
167
+ width:60%;
168
+ }
169
+
170
+ .result-body{
171
+ background: #ddd;
172
+ }
173
+
174
+ .mlt{
175
+
176
+ }
177
+
178
+ .map{
179
+ float: right;
180
+ position: relative;
181
+ top: -25px;
182
+ }
183
+
184
+ .result-document:nth-child(2n+1) {
185
+ background-color: #eee;
186
+ }
187
+
188
+
189
+ .selected-facet-field {
190
+ font-weight: bold;
191
+ }
192
+
193
+ li.show {
194
+ list-style: disc;
195
+ }
196
+
197
+ .group-value{
198
+ font-weight: bold;
199
+ }
200
+
201
+ .error {
202
+ color: white;
203
+ background-color: red;
204
+ left: 210px;
205
+ width:80%;
206
+ position: relative;
207
+
208
+ }
@@ -0,0 +1,27 @@
1
+ <div class="result-title"><b>#field('name')</b><span class="mlt"> #if($params.getBool('mlt', false) == false)<a href="#lensNoQ&q=id:$docId&mlt=true">More Like This</a>#end</span></div>
2
+ ##do we have a physical store for this product
3
+ #set($store = $doc.getFieldValue('store'))
4
+ #if($store)<div class="map"><img src="http://maps.google.com/maps/api/staticmap?&zoom=12&size=150x80&maptype=roadmap&markers=$doc.getFieldValue('store')&sensor=false" /><div><small><a target="_map" href="http://maps.google.com/?q=$store&amp;source=embed">Larger Map</a></small></div></div>#end
5
+ <div>Id: #field('id')</div>
6
+ <div>Price: #field('price_c')</div>
7
+ <div>Features: #field('features')</div>
8
+ <div>In Stock: #field('inStock')</div>
9
+ <div class="mlt">
10
+ #set($mlt = $mltResults.get($docId))
11
+ #set($mltOn = $params.getBool('mlt'))
12
+ #if($mltOn == true)<div class="field-name">Similar Items</div>#end
13
+ #if ($mltOn && $mlt && $mlt.size() > 0)
14
+ <ul>
15
+ #foreach($mltHit in $mlt)
16
+ #set($mltId = $mltHit.getFieldValue('id'))
17
+ <li><div><a href="#url_for_home?q=id:$mltId">$mltId</a></div><div><span class="field-name">Name:</span> $mltHit.getFieldValue('name')</div>
18
+ <div><span class="field-name">Price:</span> $!number.currency($mltHit.getFieldValue('price')) <span class="field-name">In Stock:</span> $mltHit.getFieldValue('inStock')</div>
19
+
20
+ </li>
21
+ #end
22
+ </ul>
23
+ #elseif($mltOn && $mlt.size() == 0)
24
+ <div>No Similar Items Found</div>
25
+ #end
26
+ </div>
27
+ #parse('debug.vm')
@@ -0,0 +1,42 @@
1
+ <div class="query-box">
2
+ <form id="query-form" action="#{url_for_home}" method="GET">
3
+ <div class="inputs">
4
+ <span #annTitle("Add the query using the &q= parameter")>Find: <input type="text" id="q" name="q" value="$!esc.html($params.get('q'))"/> <input type="submit" id="querySubmit"/> <input type="reset"/></span>
5
+ <div class="query-boost"><span #annTitle("Add the boost function &bf=price to the query")><input type="checkbox" name="bf" value="price" #if($request.params.get('bf') == 'price')checked="true"#end>Boost by Price</input></span>
6
+ #parse("querySpatial.vm")
7
+ #parse("queryGroup.vm")
8
+ </div>
9
+ </div>
10
+
11
+ #if($request.params.get('debugQuery'))
12
+ <input type="hidden" name="debugQuery" value="true"/>
13
+ #end
14
+ #if($annotate == true)
15
+ <input type="hidden" name="annotateBrowse" value="true"/>
16
+ #end
17
+ #foreach($fq in $request.params.getParams('fq'))
18
+ #if ($fq != "{!bbox}")
19
+ <input type="hidden" name="fq" id="allFQs" value="$esc.html($fq)"/>
20
+ #end
21
+ #end
22
+ <div class="constraints" #annTitle("Lists out the &fq filters. Click to remove.")>
23
+ #foreach($fq in $params.getParams('fq'))
24
+ #set($previous_fq_count=$velocityCount - 1)
25
+ #if($fq != '')
26
+ &gt; <a style="{text-decoration: line-through;}" href="#url_for_filters($request.params.getParams('fq').subList(0,$previous_fq_count))">$fq</a>
27
+ #end
28
+ #end
29
+ </div>
30
+ <div class="parsed_query_header">
31
+ #if($request.params.get('debugQuery'))
32
+ <a href="#" onclick='jQuery(this).siblings("div").toggle(); return false;'>toggle parsed query</a>
33
+ <div class="parsed_query" style="display:none">$response.response.debug.parsedquery</div>
34
+ #end
35
+ #set($queryOpts = $request.params.get("queryOpts"))
36
+ #if($queryOpts && $queryOpts != "")
37
+ <input type="hidden" name="queryOpts" value="$queryOpts"/>
38
+ #end
39
+ </div>
40
+ </form>
41
+
42
+ </div>
@@ -0,0 +1,19 @@
1
+ #set($queryOpts = $params.get("queryOpts"))
2
+ #if($queryOpts == "group")
3
+ <div>
4
+ #set($groupF = $request.params.get('group.field'))
5
+ <label #annTitle("Add the &group.field parameter. Multiselect is supported")>Group By:
6
+ <select id="group" name="group.field" multiple="true">
7
+ ##TODO: Handle multiple selects correctly
8
+ <option value="none"
9
+ #if($groupF == '')selected="true"#end>No Group</option>
10
+ <option value="manu_exact"
11
+ #if($groupF == 'manu_exact')selected="true"#end>Manufacturer</option>
12
+ <option value="popularity"
13
+ #if($groupF == 'popularity')selected="true"#end>Popularity</option>
14
+ </select>
15
+ </label>
16
+ <input type="hidden" name="group" value="true"/>
17
+ </div>
18
+
19
+ #end
@@ -0,0 +1,40 @@
1
+ #set($queryOpts = $params.get("queryOpts"))
2
+ #if($queryOpts == "spatial")
3
+ <div>
4
+ #set($loc = $request.params.get('pt'))
5
+ #set($dist = $request.params.get('d', "10"))
6
+ <label #annTitle("Add the &pt parameter")>Location Filter:
7
+ <select id="pt" name="pt">
8
+ <option value="none"
9
+ #if($loc == '')selected="true"#end>No Filter</option>
10
+ <option value="45.17614,-93.87341"
11
+ #if($loc == '45.17614,-93.87341')selected="true"#end>Buffalo, MN</option>
12
+ <option value="37.7752,-100.0232"
13
+ #if($loc == '37.7752,-100.0232')selected="true"#end>Dodge City, KS</option>
14
+ <option value="35.0752,-97.032"
15
+ #if($loc == '35.0752,-97.032')selected="true"#end>Oklahoma City, OK</option>
16
+ <option value="37.7752,-122.4232"
17
+ #if($loc == '37.7752,-122.4232')selected="true"#end>San Francisco CA</option>
18
+ </select>
19
+ </label>
20
+ <span #annTitle("Add the &d parameter")>Distance (KM): <input id="d" name="d" type="text" size="6"
21
+ value="#if($dist != '')${dist}#{else}10#end"/></span>
22
+ <input type="hidden" name="sfield" value="store"/>
23
+ <input type="hidden" id="spatialFQ" name="fq" value=""/>
24
+ <input type="hidden" name="queryOpts" value="spatial"/>
25
+ </div>
26
+ <script type="text/javascript">
27
+ $('#query-form').submit(function() {
28
+ if ($("#pt").val() != "none") {
29
+ $("#spatialFQ").val("{!bbox}");
30
+ }
31
+ $fqs = $("#allFQs").val();
32
+ $fqs = $fqs.replace("{!bbox}", "");
33
+ if ($fqs == ''){
34
+ $("#allFQs").remove();
35
+ }
36
+ $("#allFQs").val($fqs);
37
+ return true;
38
+ });
39
+ </script>
40
+ #end
@@ -0,0 +1,114 @@
1
+ ## Mimetype to extension map for detecting file type and show icon
2
+ ## List of types match the icons in /solr/img/filetypes
3
+ #set($extMap = {"application/x-7z-compressed": "7z",
4
+ "application/postscript": "ai",
5
+ "application/pgp-signature": "asc",
6
+ "application/octet-stream": "bin",
7
+ "application/x-bzip2": "bz2",
8
+ "text/x-c": "c",
9
+ "application/vnd.ms-htmlhelp": "chm",
10
+ "application/java-vm": "class",
11
+ "text/css": "css",
12
+ "text/csv": "csv",
13
+ "application/x-debian-package": "deb",
14
+ "application/msword": "doc",
15
+ "message/rfc822": "eml",
16
+ "image/gif": "gif",
17
+ "application/winhlp": "hlp",
18
+ "text/html": "html",
19
+ "application/java-archive": "jar",
20
+ "text/x-java-source": "java",
21
+ "image/jpeg": "jpeg",
22
+ "application/javascript": "js",
23
+ "application/vnd.oasis.opendocument.chart": "odc",
24
+ "application/vnd.oasis.opendocument.formula": "odf",
25
+ "application/vnd.oasis.opendocument.graphics": "odg",
26
+ "application/vnd.oasis.opendocument.image": "odi",
27
+ "application/vnd.oasis.opendocument.presentation": "odp",
28
+ "application/vnd.oasis.opendocument.spreadsheet": "ods",
29
+ "application/vnd.oasis.opendocument.text": "odt",
30
+ "application/pdf": "pdf",
31
+ "application/pgp-encrypted": "pgp",
32
+ "image/png": "png",
33
+ "application/vnd.ms-powerpoint": "ppt",
34
+ "audio/x-pn-realaudio": "ram",
35
+ "application/x-rar-compressed": "rar",
36
+ "application/vnd.rn-realmedia": "rm",
37
+ "application/rtf": "rtf",
38
+ "application/x-shockwave-flash": "swf",
39
+ "application/vnd.sun.xml.calc": "sxc",
40
+ "application/vnd.sun.xml.draw": "sxd",
41
+ "application/vnd.sun.xml.impress": "sxi",
42
+ "application/vnd.sun.xml.writer": "sxw",
43
+ "application/x-tar": "tar",
44
+ "application/x-tex": "tex",
45
+ "text/plain": "txt",
46
+ "text/x-vcard": "vcf",
47
+ "application/vnd.visio": "vsd",
48
+ "audio/x-wav": "wav",
49
+ "audio/x-ms-wma": "wma",
50
+ "video/x-ms-wmv": "wmv",
51
+ "application/vnd.ms-excel": "xls",
52
+ "application/xml": "xml",
53
+ "application/x-xpinstall": "xpi",
54
+ "application/zip": "zip"})
55
+
56
+
57
+ #if($doc.getFieldValue('title'))
58
+ #set($title = $esc.html($doc.getFirstValue('title')))
59
+ #else
60
+ #set($title = "["+$doc.getFieldValue('id')+"]")
61
+ #end
62
+ #if($doc.getFieldValue('url'))
63
+ #set($url = $doc.getFieldValue('url'))
64
+ #elseif($doc.getFieldValue('resourcename'))
65
+ #set($url = "file:///$doc.getFieldValue('resourcename')")
66
+ #else
67
+ #set($url = "$doc.getFieldValue('id')")
68
+ #end
69
+ #set($supportedtypes = "7z;ai;aiff;asc;audio;bin;bz2;c;cfc;cfm;chm;class;conf;cpp;cs;css;csv;deb;divx;doc;dot;eml;enc;file;gif;gz;hlp;htm;html;image;iso;jar;java;jpeg;jpg;js;lua;m;mm;mov;mp3;mpg;odc;odf;odg;odi;odp;ods;odt;ogg;pdf;pgp;php;pl;png;ppt;ps;py;ram;rar;rb;rm;rpm;rtf;sig;sql;swf;sxc;sxd;sxi;sxw;tar;tex;tgz;txt;vcf;video;vsd;wav;wma;wmv;xls;xml;xpi;xvid;zip")
70
+ #set($ct = $list.get($doc.getFirstValue('content_type').split(";"),0))
71
+ #set($filename = $doc.getFieldValue('resourcename'))
72
+
73
+ #set($filetype = false)
74
+ #set($filetype = $extMap.get($ct))
75
+ ##TODO: falling back to file extension is convenient, except when you don't have an icon for that extension
76
+ ## example "application/vnd.openxmlformats-officedocument.wordprocessingml.document" document
77
+ ## with a .docx extension. It'd be nice to fall back to an "unknown" or the existing "file" type
78
+ ## We sort of do this below, but only if the filename has no extension (anything after the last dot).
79
+ #if(!$filetype)#set($filetype = $filename.substring($filename.lastIndexOf(".")).substring(1))#end
80
+ ##if(!$filetype)#set($filetype = "file")#end
81
+ ##if(!$supportedtypes.contains($filetype))#set($filetype = "file")#end
82
+ <div class="result-title">
83
+ ## Small file type icons from http://www.splitbrain.org/projects/file_icons (public domain)
84
+ <img src="#{url_root}/img/filetypes/${filetype}.png" align="center">
85
+ <a href="${url}" target="_blank"><b>$title</b></a><span class="mlt"> #if($params.getBool('mlt', false) == false)<a href="#lensNoQ&q=id:%22$docId%22&mlt=true">More Like This</a>#end</span></div>
86
+ <div>Id: #field('id')</div>
87
+ <div>
88
+ #if($doc.getFieldValue('resourcename'))Resource name: $filename
89
+ #elseif($url)URL: $url
90
+ #end
91
+ #if($ct) ($ct)#end
92
+ </div>
93
+ #if($doc.getFieldValue('author'))<div>Author: #field('author')</div>#end
94
+ #if($doc.getFieldValue('last_modified'))<div>last-modified: #field('last_modified')</div>#end
95
+ <div class="result-body">#field('content')</div>
96
+ <div class="mlt">
97
+ #set($mlt = $mltResults.get($docId))
98
+ #set($mltOn = $params.getBool('mlt'))
99
+ #if($mltOn == true)<div class="field-name">Similar Items</div>#end
100
+ #if ($mltOn && $mlt && $mlt.size() > 0)
101
+ <ul>
102
+ #foreach($mltHit in $mlt)
103
+ #set($mltId = $mltHit.getFieldValue('id'))
104
+ <li><div><a href="#url_for_home?q=id:$mltId">$mltId</a></div><div><span class="field-name">Title:</span> $mltHit.getFieldValue('title')</div>
105
+ <div><span class="field-name">Author:</span> $mltHit.getFieldValue('author') <span class="field-name">Description:</span> $mltHit.getFieldValue('description')</div>
106
+
107
+ </li>
108
+ #end
109
+ </ul>
110
+ #elseif($mltOn && $mlt.size() == 0)
111
+ <div>No Similar Items Found</div>
112
+ #end
113
+ </div>
114
+ #parse('debug.vm')