supernova 0.2.1 → 0.2.2
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.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/VERSION +1 -1
- data/lib/supernova/criteria.rb +6 -2
- data/lib/supernova/solr.rb +1 -0
- data/lib/supernova/solr_criteria.rb +10 -1
- data/lib/supernova/solr_indexer.rb +71 -0
- data/solr/conf/admin-extra.html +31 -0
- data/solr/conf/elevate.xml +36 -0
- data/solr/conf/mapping-FoldToASCII.txt +3813 -0
- data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/conf/protwords.txt +21 -0
- data/solr/conf/schema.xml +475 -0
- data/solr/conf/scripts.conf +24 -0
- data/solr/conf/solrconfig.xml +1508 -0
- data/solr/conf/spellings.txt +2 -0
- data/solr/conf/stopwords.txt +58 -0
- data/solr/conf/synonyms.txt +29 -0
- data/solr/conf/velocity/VM_global_library.vm +184 -0
- data/solr/conf/velocity/browse.vm +45 -0
- data/solr/conf/velocity/cluster.vm +26 -0
- data/solr/conf/velocity/clusterResults.vm +29 -0
- data/solr/conf/velocity/doc.vm +29 -0
- data/solr/conf/velocity/facet_dates.vm +0 -0
- data/solr/conf/velocity/facet_fields.vm +12 -0
- data/solr/conf/velocity/facet_queries.vm +3 -0
- data/solr/conf/velocity/facet_ranges.vm +30 -0
- data/solr/conf/velocity/facets.vm +7 -0
- data/solr/conf/velocity/footer.vm +17 -0
- data/solr/conf/velocity/head.vm +45 -0
- data/solr/conf/velocity/header.vm +3 -0
- data/solr/conf/velocity/hit.vm +5 -0
- data/solr/conf/velocity/jquery.autocomplete.css +48 -0
- data/solr/conf/velocity/jquery.autocomplete.js +762 -0
- data/solr/conf/velocity/layout.vm +20 -0
- data/solr/conf/velocity/main.css +184 -0
- data/solr/conf/velocity/query.vm +56 -0
- data/solr/conf/velocity/querySpatial.vm +40 -0
- data/solr/conf/velocity/suggest.vm +3 -0
- data/solr/conf/velocity/tabs.vm +22 -0
- data/solr/conf/xslt/example.xsl +132 -0
- data/solr/conf/xslt/example_atom.xsl +67 -0
- data/solr/conf/xslt/example_rss.xsl +66 -0
- data/solr/conf/xslt/luke.xsl +337 -0
- data/spec/integration/solr_spec.rb +6 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/supernova/solr_criteria_spec.rb +16 -0
- data/spec/supernova/solr_indexer_spec.rb +167 -0
- data/supernova.gemspec +45 -3
- metadata +91 -36
@@ -0,0 +1,58 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
#-----------------------------------------------------------------------
|
17
|
+
# a couple of test stopwords to test that the words are really being
|
18
|
+
# configured from this file:
|
19
|
+
stopworda
|
20
|
+
stopwordb
|
21
|
+
|
22
|
+
#Standard english stop words taken from Lucene's StopAnalyzer
|
23
|
+
a
|
24
|
+
an
|
25
|
+
and
|
26
|
+
are
|
27
|
+
as
|
28
|
+
at
|
29
|
+
be
|
30
|
+
but
|
31
|
+
by
|
32
|
+
for
|
33
|
+
if
|
34
|
+
in
|
35
|
+
into
|
36
|
+
is
|
37
|
+
it
|
38
|
+
no
|
39
|
+
not
|
40
|
+
of
|
41
|
+
on
|
42
|
+
or
|
43
|
+
s
|
44
|
+
such
|
45
|
+
t
|
46
|
+
that
|
47
|
+
the
|
48
|
+
their
|
49
|
+
then
|
50
|
+
there
|
51
|
+
these
|
52
|
+
they
|
53
|
+
this
|
54
|
+
to
|
55
|
+
was
|
56
|
+
will
|
57
|
+
with
|
58
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
2
|
+
# (the "License"); you may not use this file except in compliance with
|
3
|
+
# the License. You may obtain a copy of the License at
|
4
|
+
#
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
#-----------------------------------------------------------------------
|
14
|
+
#some test synonym mappings unlikely to appear in real input text
|
15
|
+
aaafoo => aaabar
|
16
|
+
bbbfoo => bbbfoo bbbbar
|
17
|
+
cccfoo => cccbar cccbaz
|
18
|
+
fooaaa,baraaa,bazaaa
|
19
|
+
|
20
|
+
# Some synonym groups specific to this example
|
21
|
+
GB,gib,gigabyte,gigabytes
|
22
|
+
MB,mib,megabyte,megabytes
|
23
|
+
Television, Televisions, TV, TVs
|
24
|
+
#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
|
25
|
+
#after us won't split it into two words.
|
26
|
+
|
27
|
+
# Synonym mappings can be used for spelling correction too
|
28
|
+
pixima => pixma
|
29
|
+
|
@@ -0,0 +1,184 @@
|
|
1
|
+
|
2
|
+
#macro(param $key)$request.params.get($key)#end
|
3
|
+
|
4
|
+
#macro(url_for_solr)/solr#if($request.core.name != "")/$request.core.name#end#end
|
5
|
+
#macro(url_for_home)#url_for_solr/browse#end
|
6
|
+
|
7
|
+
#macro(q)&q=$!{esc.url($params.get('q'))}#end
|
8
|
+
|
9
|
+
#macro(fqs $p)#foreach($fq in $p)#if($velocityCount>1)&#{end}fq=$esc.url($fq)#end#end
|
10
|
+
|
11
|
+
#macro(debug)#if($request.params.get('debugQuery'))&debugQuery=true#end#end
|
12
|
+
|
13
|
+
#macro(boostPrice)#if($request.params.get('bf') == 'price')&bf=price#end#end
|
14
|
+
|
15
|
+
#macro(annotate)#if($request.params.get('annotateBrowse'))&annotateBrowse=true#end#end
|
16
|
+
|
17
|
+
#macro(annTitle $msg)#if($annotate == true)title="$msg"#end#end
|
18
|
+
|
19
|
+
#macro(spatial)#if($request.params.get('sfield'))&sfield=store#end#if($request.params.get('pt'))&pt=$request.params.get('pt')#end#if($request.params.get('d'))&d=$request.params.get('d')#end#end
|
20
|
+
|
21
|
+
#macro(qOpts)#set($queryOpts = $request.params.get("queryOpts"))#if($queryOpts && $queryOpts != "")&queryOpts=$queryOpts#end#end
|
22
|
+
|
23
|
+
#macro(lensNoQ)?#if($request.params.getParams('fq') and $list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug#boostPrice#annotate#spatial#qOpts#end
|
24
|
+
#macro(lens)#lensNoQ#q#end
|
25
|
+
|
26
|
+
|
27
|
+
#macro(url_for_lens)#{url_for_home}#lens#end
|
28
|
+
|
29
|
+
#macro(url_for_start $start)#url_for_home#lens&start=$start#end
|
30
|
+
|
31
|
+
#macro(url_for_filters $p)#url_for_home?#q#boostPrice#spatial#qOpts#if($list.size($p) > 0)&#fqs($p)#end#debug#end
|
32
|
+
|
33
|
+
#macro(url_for_nested_facet_query $field)#url_for_home#lens&fq=$esc.url($field)#end
|
34
|
+
|
35
|
+
## TODO: convert to use {!raw f=$field}$value (with escaping of course)
|
36
|
+
#macro(url_for_facet_filter $field $value)#url_for_home#lens&fq=$esc.url($field):%22$esc.url($value)%22#end
|
37
|
+
|
38
|
+
#macro(url_for_facet_date_filter $field $value)#url_for_home#lens&fq=$esc.url($field):$esc.url($value)#end
|
39
|
+
|
40
|
+
#macro(url_for_facet_range_filter $field $value)#url_for_home#lens&fq=$esc.url($field):$esc.url($value)#end
|
41
|
+
|
42
|
+
|
43
|
+
#macro(link_to_previous_page $text)
|
44
|
+
#if($page.current_page_number > 1)
|
45
|
+
#set($prev_start = $page.start - $page.results_per_page)
|
46
|
+
<a class="prev-page" href="#url_for_start($prev_start)">$text</a>
|
47
|
+
#end
|
48
|
+
#end
|
49
|
+
|
50
|
+
#macro(link_to_next_page $text)
|
51
|
+
#if($page.current_page_number < $page.page_count)
|
52
|
+
#set($next_start = $page.start + $page.results_per_page)
|
53
|
+
<a class="next-page" href="#url_for_start($next_start)">$text</a>
|
54
|
+
#end
|
55
|
+
#end
|
56
|
+
|
57
|
+
#macro(link_to_page $page_number $text)
|
58
|
+
#if($page_number == $page.current_page_number)
|
59
|
+
$text
|
60
|
+
#else
|
61
|
+
#if($page_number <= $page.page_count)
|
62
|
+
#set($page_start = $page_number * $page.results_per_page - $page.results_per_page)
|
63
|
+
<a class="page" href="#url_for_start($page_start)">$text</a>
|
64
|
+
#end
|
65
|
+
#end
|
66
|
+
#end
|
67
|
+
|
68
|
+
#macro(display_facet_query $field, $display, $fieldName)
|
69
|
+
#if($field.size() > 0)
|
70
|
+
<span class="facet-field">$display</span>
|
71
|
+
<ul>
|
72
|
+
#foreach ($facet in $field)
|
73
|
+
#if ($facet.value > 0)
|
74
|
+
#set($facetURL = "#url_for_nested_facet_query($facet.key)")
|
75
|
+
#if ($facetURL != '')
|
76
|
+
<li><a href="$facetURL">$facet.key</a> ($facet.value)</li>
|
77
|
+
#end
|
78
|
+
#end
|
79
|
+
#end
|
80
|
+
</ul>
|
81
|
+
#end
|
82
|
+
#end
|
83
|
+
|
84
|
+
#macro(display_facet_range_date $field, $display, $fieldName)
|
85
|
+
<span class="facet-field">$display</span>
|
86
|
+
##Note: even if mincount is 1, you can still get a '0' before & after
|
87
|
+
##Note: We assume facet.range.include='lower'
|
88
|
+
<ul>
|
89
|
+
#if ($field.before && $field.before > 0)
|
90
|
+
#set($value = "[* TO " + $date.format("yyyy-MM-dd'T'HH:mm:ss'Z'", $field.start) + "-1MILLIS]")
|
91
|
+
#set($facetURL = "#url_for_facet_date_filter($fieldName, $value)")
|
92
|
+
<li><a href="$facetURL">Before</a> ($field.before)</li>
|
93
|
+
#end
|
94
|
+
#foreach ($facet in $field.counts)
|
95
|
+
#set($theDate = $date.toDate("yyyy-MM-dd'T'HH:mm:ss'Z'", $facet.key))
|
96
|
+
#set($value = '["' + $facet.key + '" TO "' + $facet.key + $field.gap + '-1MILLIS"]')
|
97
|
+
|
98
|
+
#set($facetURL = "#url_for_facet_date_filter($fieldName, $value)")
|
99
|
+
#if ($facetURL != '')
|
100
|
+
<li><a href="$facetURL">$date.format('MMM yyyy', $theDate)</a> ($facet.value)</li>
|
101
|
+
#end
|
102
|
+
#end
|
103
|
+
#if ($field.after && $field.after > 0)
|
104
|
+
#set($value = "[" + $date.format("yyyy-MM-dd'T'HH:mm:ss'Z'", $field.after) + " TO *]")
|
105
|
+
#set($facetURL = "#url_for_facet_date_filter($fieldName, $value)")
|
106
|
+
<li><a href="$facetURL">After</a> ($field.after)</li>
|
107
|
+
#end
|
108
|
+
</ul>
|
109
|
+
#end
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
#macro(display_facet_range $field, $display, $fieldName, $start, $end, $gap, $before, $after)
|
114
|
+
<span class="facet-field">$display</span>
|
115
|
+
<ul>
|
116
|
+
#if($before && $before != "")
|
117
|
+
#set($value = "[* TO " + $start + "]")
|
118
|
+
#set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
|
119
|
+
<li><a href="$facetURL">Less than $start</a> ($before)</li>
|
120
|
+
#end
|
121
|
+
#foreach ($facet in $field)
|
122
|
+
#set($rangeEnd = $math.add($facet.key, $gap))
|
123
|
+
#set($value = "[" + $facet.key + " TO " + $rangeEnd + "]")
|
124
|
+
#set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
|
125
|
+
#if ($facetURL != '')
|
126
|
+
<li><a href="$facetURL">$facet.key</a> ($facet.value)</li>
|
127
|
+
#end
|
128
|
+
#end
|
129
|
+
#if($end && $end != "")
|
130
|
+
#set($value = "[" + $end + " TO *]")
|
131
|
+
#set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
|
132
|
+
<li><a href="$facetURL">More than $math.toNumber($end)</a> ($after)</li>
|
133
|
+
#end
|
134
|
+
</ul>
|
135
|
+
#end
|
136
|
+
|
137
|
+
## <lst name="facet_pivot">
|
138
|
+
## <arr name="cat,inStock">
|
139
|
+
## <lst>
|
140
|
+
## <str name="field">cat</str>
|
141
|
+
## <str name="value">electronics</str>
|
142
|
+
## <int name="count">17</int>
|
143
|
+
## <arr name="pivot">
|
144
|
+
## <lst>
|
145
|
+
## <str name="field">inStock</str>
|
146
|
+
## <str name="value">true</str>
|
147
|
+
## <int name="count">13</int>
|
148
|
+
## </lst>
|
149
|
+
## <lst>
|
150
|
+
## <str name="field">inStock</str>
|
151
|
+
## <str name="value">false</str>
|
152
|
+
## <int name="count">4</int>
|
153
|
+
## </lst>
|
154
|
+
## </arr>
|
155
|
+
## </lst>
|
156
|
+
|
157
|
+
## $pivots is a list of facet_pivot
|
158
|
+
#macro(display_facet_pivot $pivots, $display)
|
159
|
+
#if($pivots.size() > 0)
|
160
|
+
<span class="facet-field">$display</span>
|
161
|
+
<ul>
|
162
|
+
#foreach ($pivot in $pivots)
|
163
|
+
#foreach ($entry in $pivot.value)
|
164
|
+
<a href="#url_for_facet_filter($entry.field, $entry.value)">$entry.field::$entry.value</a> ($entry.count)
|
165
|
+
<ul>
|
166
|
+
#foreach($nest in $entry.pivot)
|
167
|
+
<a href="#url_for_facet_filter($entry.field, $entry.value)&fq=$esc.url($nest.field):%22$esc.url($nest.value)%22">$nest.field::$nest.value</a> ($nest.count)
|
168
|
+
#end
|
169
|
+
</ul>
|
170
|
+
#end
|
171
|
+
#end
|
172
|
+
</ul>
|
173
|
+
#end
|
174
|
+
#end
|
175
|
+
|
176
|
+
#macro(field $f)
|
177
|
+
#if($response.response.highlighting.get($docId).get($f).get(0))
|
178
|
+
$!response.response.highlighting.get($docId).get($f).get(0)
|
179
|
+
#else
|
180
|
+
#foreach($v in $doc.getFieldValues($f))
|
181
|
+
$v
|
182
|
+
#end
|
183
|
+
#end
|
184
|
+
#end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#set($searcher=$request.searcher)
|
2
|
+
#set($params=$request.params)
|
3
|
+
#set($clusters = $response.response.clusters)
|
4
|
+
#set($mltResults = $response.response.get("moreLikeThis"))
|
5
|
+
#set($annotate = $params.get("annotateBrowse"))
|
6
|
+
#parse('query.vm')
|
7
|
+
#if($response.response.spellcheck.suggestions and $response.response.spellcheck.suggestions.size() > 0)
|
8
|
+
Did you mean <a href="#url_for_home?q=$esc.url($response.response.spellcheck.suggestions.collation)#if($list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug">$response.response.spellcheck.suggestions.collation</a>?
|
9
|
+
#end
|
10
|
+
|
11
|
+
<div class="navigators">
|
12
|
+
#parse("facets.vm")
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="pagination">
|
16
|
+
#if($response.response.get('grouped'))
|
17
|
+
<span><span class="results-found">$response.response.get('grouped').size() group(s)</span> found in ${response.responseHeader.QTime} ms</span>
|
18
|
+
#else<span><span class="results-found">$page.results_found</span> results found in ${response.responseHeader.QTime} ms</span>
|
19
|
+
Page <span class="page-num">$page.current_page_number</span> of <span
|
20
|
+
class="page-count">$page.page_count</span>#end
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="results">
|
24
|
+
#if($response.response.get('grouped'))
|
25
|
+
#foreach($grouping in $response.response.get('grouped'))
|
26
|
+
#parse("hitGrouped.vm")
|
27
|
+
#end
|
28
|
+
#else
|
29
|
+
#foreach($doc in $response.results)
|
30
|
+
#parse("hit.vm")
|
31
|
+
#end
|
32
|
+
#end
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="pagination">
|
36
|
+
#if($response.response.get('grouped'))
|
37
|
+
#else
|
38
|
+
#link_to_previous_page("previous")
|
39
|
+
<span class="results-found">$page.results_found</span> results found.
|
40
|
+
Page <span class="page-num">$page.current_page_number</span> of <span
|
41
|
+
class="page-count">$page.page_count</span>
|
42
|
+
#link_to_next_page("next")
|
43
|
+
#end
|
44
|
+
<br/>
|
45
|
+
</div>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!--
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
contributor license agreements. See the NOTICE file distributed with
|
4
|
+
this work for additional information regarding copyright ownership.
|
5
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
(the "License"); you may not use this file except in compliance with
|
7
|
+
the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
-->
|
17
|
+
|
18
|
+
<h2 #annTitle("Clusters generated by Carrot2 using the /clustering RequestHandler")>Clusters</h2>
|
19
|
+
<div id="clusters">
|
20
|
+
Run Solr with java -Dsolr.clustering.enabled=true -jar start.jar to see results
|
21
|
+
</div>
|
22
|
+
<script type="text/javascript">
|
23
|
+
|
24
|
+
$('#clusters').load("#url_for_solr/clustering#lens",
|
25
|
+
{'wt':'velocity', 'v.template':"clusterResults"});
|
26
|
+
</script>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#foreach ($clusters in $response.response.clusters)
|
2
|
+
#set($labels = $clusters.get('labels'))
|
3
|
+
#set($docs = $clusters.get('docs'))
|
4
|
+
<!--
|
5
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
6
|
+
contributor license agreements. See the NOTICE file distributed with
|
7
|
+
this work for additional information regarding copyright ownership.
|
8
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
9
|
+
(the "License"); you may not use this file except in compliance with
|
10
|
+
the License. You may obtain a copy of the License at
|
11
|
+
|
12
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
See the License for the specific language governing permissions and
|
18
|
+
limitations under the License.
|
19
|
+
-->
|
20
|
+
|
21
|
+
<h3>#foreach ($label in $labels)$label#if( $foreach.hasNext ),#end#end</h3>
|
22
|
+
<ol>
|
23
|
+
#foreach ($cluDoc in $docs)
|
24
|
+
<li><a href="#url_for_home?q=id:$cluDoc">$cluDoc</a></li>
|
25
|
+
#end
|
26
|
+
</ol>
|
27
|
+
|
28
|
+
|
29
|
+
#end
|
@@ -0,0 +1,29 @@
|
|
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&source=embed">Larger Map</a></small></div></div>#end
|
5
|
+
<div>Price: $!number.currency($doc.getFieldValue('price'))</div>
|
6
|
+
<div>Features: #field('features')</div>
|
7
|
+
<div>In Stock: #field('inStock')</div>
|
8
|
+
<div class="mlt">
|
9
|
+
#set($mlt = $mltResults.get($docId))
|
10
|
+
#set($mltOn = $params.getBool('mlt'))
|
11
|
+
#if($mltOn == true)<div class="field-name">Similar Items</div>#end
|
12
|
+
#if ($mltOn && $mlt && $mlt.size() > 0)
|
13
|
+
<ul>
|
14
|
+
#foreach($mltHit in $mlt)
|
15
|
+
#set($mltId = $mltHit.getFieldValue('id'))
|
16
|
+
<li><div><a href="#url_for_home?q=id:$mltId">$mltId</a></div><div><span class="field-name">Name:</span> $mltHit.getFieldValue('name')</div>
|
17
|
+
<div><span class="field-name">Price:</span> $!number.currency($mltHit.getFieldValue('price')) <span class="field-name">In Stock:</span> $mltHit.getFieldValue('inStock')</div>
|
18
|
+
|
19
|
+
</li>
|
20
|
+
#end
|
21
|
+
</ul>
|
22
|
+
#elseif($mltOn && $mlt.size() == 0)
|
23
|
+
<div>No Similar Items Found</div>
|
24
|
+
#end
|
25
|
+
</div>
|
26
|
+
#if($params.getBool("debugQuery",false))
|
27
|
+
<a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle explain</a>
|
28
|
+
<pre style="display:none">$response.getExplainMap().get($doc.getFirstValue('id'))</pre>
|
29
|
+
#end
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#if($response.facetFields)
|
2
|
+
<h2 #annTitle("Facets generated by adding &facet.field= to the request")>Field Facets</h2>
|
3
|
+
#foreach($field in $response.facetFields)
|
4
|
+
<span class="facet-field">$field.name</span>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
#foreach($facet in $field.values)
|
8
|
+
<li><a href="#url_for_facet_filter($field.name, $facet.name)">$facet.name</a> ($facet.count)</li>
|
9
|
+
#end
|
10
|
+
</ul>
|
11
|
+
#end
|
12
|
+
#end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<!--
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
contributor license agreements. See the NOTICE file distributed with
|
4
|
+
this work for additional information regarding copyright ownership.
|
5
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
(the "License"); you may not use this file except in compliance with
|
7
|
+
the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
-->
|
17
|
+
|
18
|
+
<h2 #annTitle("Facets generated by adding &facet.range= to the request")>Range Facets</h2>
|
19
|
+
#set($field = $response.response.facet_counts.facet_ranges.price.counts)
|
20
|
+
#set($start = $response.response.facet_counts.facet_ranges.price.start)
|
21
|
+
#set($end = $response.response.facet_counts.facet_ranges.price.end)
|
22
|
+
#set($gap = $response.response.facet_counts.facet_ranges.price.gap)
|
23
|
+
#set($before = $response.response.facet_counts.facet_ranges.price.before)
|
24
|
+
#set($after = $response.response.facet_counts.facet_ranges.price.after)
|
25
|
+
##TODO: Make this display the "range", not just the lower value
|
26
|
+
##TODO: Have a generic way to deal with ranges
|
27
|
+
#display_facet_range($field, "Price (in $)", "price", $start, $end, $gap, $before, $after)
|
28
|
+
|
29
|
+
#set($field = $response.response.facet_counts.facet_ranges.manufacturedate_dt)
|
30
|
+
#display_facet_range_date($field, "Manufacture Date", "manufacturedate_dt")
|