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,20 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
#parse("head.vm")
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<div id="admin"><a href="#url_for_solr/admin">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,184 @@
|
|
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
|
+
body {
|
22
|
+
font-family: Helvetica, Arial, sans-serif;
|
23
|
+
font-size: 10pt;
|
24
|
+
}
|
25
|
+
|
26
|
+
a {
|
27
|
+
color: #43a4b1;
|
28
|
+
}
|
29
|
+
|
30
|
+
.navigators {
|
31
|
+
float: left;
|
32
|
+
margin: 5px;
|
33
|
+
margin-top: 0px;
|
34
|
+
width: 185px;
|
35
|
+
padding: 5px;
|
36
|
+
top: -20px;
|
37
|
+
position: relative;
|
38
|
+
}
|
39
|
+
|
40
|
+
.navigators h2 {
|
41
|
+
background: #FEC293;
|
42
|
+
border: 1px solid #ce9d77;
|
43
|
+
padding: 5px;
|
44
|
+
}
|
45
|
+
|
46
|
+
.navigators ul {
|
47
|
+
list-style: none;
|
48
|
+
margin: 0;
|
49
|
+
margin-bottom: 5px;
|
50
|
+
margin-top: 5px;
|
51
|
+
padding-left: 10px;
|
52
|
+
}
|
53
|
+
|
54
|
+
.navigators ul li {
|
55
|
+
color: #999;
|
56
|
+
padding: 2px;
|
57
|
+
text-transform: capitalize;
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
.facet-field {
|
63
|
+
font-weight: bold;
|
64
|
+
}
|
65
|
+
|
66
|
+
.highlight {
|
67
|
+
color: white;
|
68
|
+
background-color: gray;
|
69
|
+
border: 1px black solid;
|
70
|
+
}
|
71
|
+
|
72
|
+
.highlight-box {
|
73
|
+
margin-left: 15px;
|
74
|
+
}
|
75
|
+
|
76
|
+
.field-name {
|
77
|
+
font-weight: bold;
|
78
|
+
}
|
79
|
+
|
80
|
+
.highlighted-facet-field {
|
81
|
+
background: white;
|
82
|
+
}
|
83
|
+
|
84
|
+
.constraints {
|
85
|
+
margin-top: 10px;
|
86
|
+
}
|
87
|
+
|
88
|
+
#query-form{
|
89
|
+
width: 80%;
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
.query-box, .constraints {
|
95
|
+
padding: 5px;
|
96
|
+
margin: 5px;
|
97
|
+
font-weight: normal;
|
98
|
+
font-size: 24px;
|
99
|
+
letter-spacing: 0.08em;
|
100
|
+
}
|
101
|
+
|
102
|
+
.query-box #q {
|
103
|
+
margin-left: 8px;
|
104
|
+
width: 60%;
|
105
|
+
height: 50px;
|
106
|
+
border: 1px solid #999;
|
107
|
+
font-size: 1em;
|
108
|
+
padding: 0.4em;
|
109
|
+
}
|
110
|
+
|
111
|
+
.query-box {
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
.query-boost {
|
116
|
+
|
117
|
+
top: 10px;
|
118
|
+
left: 50px;
|
119
|
+
position: relative;
|
120
|
+
font-size: 0.8em;
|
121
|
+
}
|
122
|
+
|
123
|
+
.query-box .inputs{
|
124
|
+
left: 180px;
|
125
|
+
position: relative;
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
#logo {
|
130
|
+
margin: 10px;
|
131
|
+
border-style: none;
|
132
|
+
}
|
133
|
+
|
134
|
+
.pagination {
|
135
|
+
padding-left: 33%;
|
136
|
+
background: #eee;
|
137
|
+
margin: 5px;
|
138
|
+
margin-left: 210px;
|
139
|
+
padding-top: 5px;
|
140
|
+
padding-bottom: 5px;
|
141
|
+
}
|
142
|
+
|
143
|
+
.result-document {
|
144
|
+
border: 1px solid #999;
|
145
|
+
padding: 5px;
|
146
|
+
margin: 5px;
|
147
|
+
margin-left: 210px;
|
148
|
+
margin-bottom: 15px;
|
149
|
+
}
|
150
|
+
|
151
|
+
.result-document div{
|
152
|
+
padding: 5px;
|
153
|
+
}
|
154
|
+
|
155
|
+
.result-title{
|
156
|
+
width:60%;
|
157
|
+
}
|
158
|
+
|
159
|
+
.mlt{
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
.map{
|
164
|
+
float: right;
|
165
|
+
position: relative;
|
166
|
+
top: -25px;
|
167
|
+
}
|
168
|
+
|
169
|
+
.result-document:nth-child(2n+1) {
|
170
|
+
background-color: #eee;
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
.selected-facet-field {
|
175
|
+
font-weight: bold;
|
176
|
+
}
|
177
|
+
|
178
|
+
li.show {
|
179
|
+
list-style: disc;
|
180
|
+
}
|
181
|
+
|
182
|
+
.group-value{
|
183
|
+
font-weight: bold;
|
184
|
+
}
|
@@ -0,0 +1,56 @@
|
|
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
|
+
<div class="query-box">
|
19
|
+
<form id="query-form" action="#{url_for_home}" method="GET">
|
20
|
+
<div class="inputs">
|
21
|
+
<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>
|
22
|
+
<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>
|
23
|
+
#parse("querySpatial.vm")
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
#if($request.params.get('debugQuery'))
|
28
|
+
<input type="hidden" name="debugQuery" value="true"/>
|
29
|
+
#end
|
30
|
+
#if($annotate == true)
|
31
|
+
<input type="hidden" name="annotateBrowse" value="true"/>
|
32
|
+
#end
|
33
|
+
#foreach($fq in $request.params.getParams('fq'))
|
34
|
+
#if ($fq != "{!bbox}")
|
35
|
+
<input type="hidden" name="fq" id="allFQs" value="$esc.html($fq)"/>
|
36
|
+
#end
|
37
|
+
#end
|
38
|
+
<div class="constraints" #annTitle("Lists out the &fq filters. Click to remove.")>
|
39
|
+
#foreach($fq in $params.getParams('fq'))
|
40
|
+
#set($previous_fq_count=$velocityCount - 1)
|
41
|
+
#if($fq != '')
|
42
|
+
> <a style="{text-decoration: line-through;}" href="#url_for_filters($request.params.getParams('fq').subList(0,$previous_fq_count))">$fq</a>
|
43
|
+
#end
|
44
|
+
#end
|
45
|
+
</div>
|
46
|
+
#if($request.params.get('debugQuery'))
|
47
|
+
<a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle parsed query</a>
|
48
|
+
<pre style="display:none">$response.response.debug.parsedquery</pre>
|
49
|
+
#end
|
50
|
+
#set($queryOpts = $request.params.get("queryOpts"))
|
51
|
+
#if($queryOpts && $queryOpts != "")
|
52
|
+
<input type="hidden" name="queryOpts" value="$queryOpts"/>
|
53
|
+
#end
|
54
|
+
</form>
|
55
|
+
|
56
|
+
</div>
|
@@ -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,22 @@
|
|
1
|
+
##TODO: Make some nice tabs here
|
2
|
+
#set($queryOpts = $params.get("queryOpts"))
|
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
|
+
<span #annTitle("Click the link to demonstrate various Solr capabilities")><span>Examples: </span><span class="tab">#if($queryOpts && $queryOpts != "")<a href="#url_for_home">Simple</a>#{else}Simple#end</span>
|
21
|
+
<span class="tab">#if($queryOpts == "spatial")Spatial#else<a href="#url_for_home?&queryOpts=spatial">Spatial</a>#end</span>
|
22
|
+
<hr/>
|
@@ -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>
|