Skip to content

Commit

Permalink
Updated to Solr 4.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pkainulainen committed Jun 1, 2013
1 parent dd7e195 commit 2afc39b
Show file tree
Hide file tree
Showing 15 changed files with 184 additions and 40 deletions.
29 changes: 24 additions & 5 deletions running-solr-with-maven/etc/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@
<types> fieldType section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
docValues: true if this field should have doc values. Doc values are
useful for faceting, grouping, sorting and function queries. Although not
required, doc values will make the index faster to load, more
NRT-friendly and more memory-efficient. They however come with some
limitations: they are currently only supported by StrField, UUIDField
and all Trie*Fields, and depending on the field type, they might
require the field to be single-valued, be required or have a default
value (check the documentation of the field type you're interested in
for more information)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
Expand Down Expand Up @@ -156,11 +165,15 @@

<field name="_version_" type="long" indexed="true" stored="true"/>

<!-- Uncommenting the following will create a "timestamp" field using
a default value of "NOW" to indicate when each document was indexed.
-->
<!--
<field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
Some fields such as popularity and manu_exact could be modified to
leverage doc values:
<field name="popularity" type="int" indexed="true" stored="true" docValues="true" default="0" />
<field name="manu_exact" type="string" indexed="false" stored="false" docValues="true" default="" />
Although it would make indexing slightly slower and the index bigger, it
would also make the index faster to load, more memory-efficient and more
NRT-friendly.
-->

<!-- Dynamic field definitions allow using convention over configuration
Expand Down Expand Up @@ -282,7 +295,10 @@
standard package such as org.apache.solr.analysis
-->

<!-- The StrField type is not analyzed, but indexed/stored verbatim. -->
<!-- The StrField type is not analyzed, but indexed/stored verbatim.
It supports doc values but in that case the field needs to be
single-valued and either required or have a default value.
-->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />

<!-- boolean type: "true" or "false" -->
Expand All @@ -306,6 +322,9 @@

<!--
Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
These fields support doc values, but they require the field to be
single-valued and either be required or have a default value.
-->
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
Expand Down
30 changes: 29 additions & 1 deletion running-solr-with-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
</license>
</licenses>
<properties>
<solr.version>4.1.0</solr.version>
<slf4j.version>1.7.5</slf4j.version>
<solr.version>4.3.0</solr.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
Expand All @@ -31,6 +32,33 @@
</profile>
</profiles>
<dependencies>
<!-- SLF4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- Solr 4.3.0 -->
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion running-solr-with-maven/profiles/dev/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ solr.default.core.name=todo

#SYSTEM PROPERTIES
#Configures the home directory of Solr
solr.solr.home=
solr.solr.home=/Users/loke/Projects/Java/Blog/tmp/solr
17 changes: 5 additions & 12 deletions running-solr-with-maven/src/main/config/admin-extra.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,10 @@
limitations under the License.
-->

<!-- The content of this page will be statically included into the top
of the admin page. Uncomment this as an example to see there the content
will show up.
<hr>
<i>This line will appear before the first table</i>
<tr>
<td colspan="2">
This row will be appended to the end of the first table
</td>
</tr>
<hr>
<!-- The content of this page will be statically included into the top-
right box of the cores overview page. Uncomment this as an example to
see there the content will show up.
<img src="img/ico/construction.png"> This line will appear at the top-
right box on collection1's Overview
-->
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- admin-extra.menu-bottom.html -->
<!--
<li>
<a href="#" style="background-image: url(img/ico/construction.png);">
LAST ITEM
</a>
</li>
-->
24 changes: 24 additions & 0 deletions running-solr-with-maven/src/main/config/admin-extra.menu-top.html
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- admin-extra.menu-top.html -->
<!--
<li>
<a href="#" style="background-image: url(img/ico/construction.png);">
FIRST ITEM
</a>
</li>
-->
12 changes: 11 additions & 1 deletion running-solr-with-maven/src/main/config/elevate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,15 @@
-->
<elevate>

<query text="foo bar">
<doc id="1" />
<doc id="2" />
<doc id="3" />
</query>

<query text="ipod">
<doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
<doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
</query>

</elevate>
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ eussent

| Later additions (from Jean-Christophe Deschamps)
ceci | this
celà  | that
cela | that
celà | that
cet | this
cette | this
ici | here
Expand Down
57 changes: 44 additions & 13 deletions running-solr-with-maven/src/main/config/solrconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
that you fully re-index after changing this setting as it can
affect both how text is indexed and queried.
-->
<luceneMatchVersion>LUCENE_41</luceneMatchVersion>
<luceneMatchVersion>LUCENE_43</luceneMatchVersion>

<!-- <lib/> directives can be used to instruct Solr to load an Jars
identified and use them to resolve any "plugins" specified in
Expand Down Expand Up @@ -82,9 +82,9 @@
<lib dir="../../../dist/" regex="solr-velocity-\d.*\.jar" />

<!-- If a 'dir' option (with or without a regex) is used and nothing
is found that matches, it will be ignored
is found that matches, a warning will be logged.
-->
<lib dir="/total/crap/dir/ignored" />
<lib dir="/non/existent/dir/yields/warning" />

<!-- an exact 'path' can be used instead of a 'dir' to specify a
specific jar file. This will cause a serious error to be logged
Expand Down Expand Up @@ -121,6 +121,39 @@
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>

<!-- The CodecFactory for defining the format of the inverted index.
The default implementation is SchemaCodecFactory, which is the official Lucene
index format, but hooks into the schema to provide per-field customization of
the postings lists and per-document values in the fieldType element
(postingsFormat/docValuesFormat). Note that most of the alternative implementations
are experimental, so if you choose to customize the index format, its a good
idea to convert back to the official format e.g. via IndexWriter.addIndexes(IndexReader)
before upgrading to a newer version to avoid unnecessary reindexing.
-->
<codecFactory class="solr.SchemaCodecFactory"/>

<!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
<schemaFactory class="ManagedIndexSchemaFactory">
<bool name="mutable">true</bool>
<str name="managedSchemaResourceName">managed-schema</str>
</schemaFactory>
When ManagedIndexSchemaFactory is specified, Solr will load the schema from
he resource named in 'managedSchemaResourceName', rather than from schema.xml.
Note that the managed schema resource CANNOT be named schema.xml. If the managed
schema does not exist, Solr will create it after reading schema.xml, then rename
'schema.xml' to 'schema.xml.bak'.
Do NOT hand edit the managed schema - external modifications will be ignored and
overwritten as a result of schema modification REST API calls.
When ManagedIndexSchemaFactory is specified with mutable = true, schema
modification REST API calls will be allowed; otherwise, error responses will be
sent back for these requests.
-->
<schemaFactory class="ClassicIndexSchemaFactory"/>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index Config - These settings control low-level behavior of indexing
Most example settings here show the default value, but are commented
Expand Down Expand Up @@ -211,7 +244,7 @@
More details on the nuances of each LockFactory...
http://wiki.apache.org/lucene-java/AvailableLockFactories
-->
<!-- <lockType>native</lockType> -->
<lockType>${solr.lock.type:native}</lockType>

<!-- Unlock On Startup
Expand All @@ -220,7 +253,7 @@
processes to safely access a lucene index, and should be used
with care. Default is "false".
This is not needed if lock type is 'none' or 'single'
This is not needed if lock type is 'single'
-->
<!--
<unlockOnStartup>false</unlockOnStartup>
Expand All @@ -239,12 +272,9 @@
-->

<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
http://lucene.apache.org/java/3_5_0/api/core/org/apache/lucene/index/IndexDeletionPolicy.html
The default Solr IndexDeletionPolicy implementation supports
deleting index commit points on number of commits, age of
commit point and optimized status.
Expand Down Expand Up @@ -326,7 +356,7 @@
commit before automatically triggering a new commit.
maxTime - Maximum amount of time in ms that is allowed to pass
since a document was added before automaticly
since a document was added before automatically
triggering a new commit.
openSearcher - if false, the commit causes recent index changes
to be flushed to stable storage, but does not cause a new
Expand Down Expand Up @@ -1126,7 +1156,7 @@
http://wiki.apache.org/solr/SolrReplication
It is also neccessary for SolrCloud to function (in Cloud mode, the
It is also necessary for SolrCloud to function (in Cloud mode, the
replication handler is used to bulk transfer segments when nodes
are added or need to recover).
Expand All @@ -1135,7 +1165,7 @@
<requestHandler name="/replication" class="solr.ReplicationHandler" >
<!--
To enable simple master/slave replication, uncomment one of the
sections below, depending on wether this solr instance should be
sections below, depending on whether this solr instance should be
the "master" or a "slave". If this instance is a "slave" you will
also need to fill in the masterUrl to point to a real machine.
-->
Expand Down Expand Up @@ -1206,7 +1236,7 @@
-->
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">

<str name="queryAnalyzerFieldType">textSpell</str>
<str name="queryAnalyzerFieldType">text_general</str>

<!-- Multiple "Spell Checkers" can be declared and used by this
component
Expand All @@ -1215,7 +1245,7 @@
<!-- a spellchecker built from a field of the main index -->
<lst name="spellchecker">
<str name="name">default</str>
<str name="field">name</str>
<str name="field">text</str>
<str name="classname">solr.DirectSolrSpellChecker</str>
<!-- the spellcheck distance measure used, the default is the internal levenshtein -->
<str name="distanceMeasure">internal</str>
Expand Down Expand Up @@ -1701,6 +1731,7 @@
<queryResponseWriter name="php" class="solr.PHPResponseWriter"/>
<queryResponseWriter name="phps" class="solr.PHPSerializedResponseWriter"/>
<queryResponseWriter name="csv" class="solr.CSVResponseWriter"/>
<queryResponseWriter name="schema.xml" class="solr.SchemaXmlResponseWriter"/>
-->

<queryResponseWriter name="json" class="solr.JSONResponseWriter">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@

#macro(group)#if($request.params.getBool("group") == true)&group=true#end#if($request.params.get("group.field"))#foreach($grp in $request.params.getParams('group.field'))&group.field=$grp#end#end#end

#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#group#end
#macro(sort $p)#if($p)#foreach($s in $p)&sort=$esc.url($s)#end#end#end

#macro(lensNoQ)?#if($request.params.getParams('fq') and $list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#sort($request.params.getParams('sort'))#debug#boostPrice#annotate#spatial#qOpts#group#end
#macro(lens)#lensNoQ#q#end


Expand Down
4 changes: 1 addition & 3 deletions running-solr-with-maven/src/main/config/velocity/browse.vm
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#set($mltResults = $response.response.get("moreLikeThis"))
#set($annotate = $params.get("annotateBrowse"))
#parse('query.vm')
#if($response.response.spellcheck.suggestions and $response.response.spellcheck.suggestions.size() > 0)
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>?
#end
#parse('did_you_mean.vm')

<div class="navigators">
#parse("facets.vm")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#set($dym = $response.response.spellcheck.suggestions.collation.collationQuery)
#if($dym)
Did you mean <a href="#{url_for_home}#{lensNoQ}&q=$esc.url($dym)">$esc.html($dym)</a>?
#end
6 changes: 5 additions & 1 deletion running-solr-with-maven/src/main/config/velocity/head.vm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
'v.template': 'suggest'
}
}
);
).keydown(function(e){
if (e.keyCode === 13){
$("#query-form").trigger('submit');
}
});

// http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=i&terms.sort=count
});
Expand Down
Loading

0 comments on commit 2afc39b

Please sign in to comment.