Solr

solr

Solr automatic core update as deployment step

2

For my projects I use the awesome tool Capistrano for deployment. In a project that uses Solr, I want to update the Solr core as a deployment step if the Solr configuration of that core is changed. After the reload of the configuration I want to do a full import with the Solr Data Import Handler.

If you have a large import then this can take a while. But it is possible to do this without any downtime! The trick is to work with two cores. A “live” core and a “on deck” core. The More >

solr-4

Ubuntu 12.04 – Install Solr 4 with Jetty 9

8

This tutorial requires that Jetty is installed as described at http://pietervogelaar.nl/ubuntu-12-04-install-jetty-9.

In this tutorial we use an example project named “airport” and a core named “flight”.

cd /opt
wget http://apache.hippo.nl/lucene/solr/4.0.0/apache-solr-4.0.0.tgz
tar -xvf apache-solr-4.0.0.tgz
cp apache-solr-4.0.0/dist/apache-solr-4.0.0.war /opt/jetty/webapps/solr.war
cp -R apache-solr-4.0.0/example/solr /opt

Optionally you can copy the “dist” and “contrib” folder as while if you want to use the data import handler for example:

cp -r /opt/apache-solr-4.0.0/dist /opt/solr
cp -r /opt/apache-solr-4.0.0/contrib /opt/solr

Add to the bottom of /etc/default/jetty this line:

JAVA_OPTIONS="-Dsolr.solr.home=/opt/solr $JAVA_OPTIONS"

Add a Solr core, as example copy the More >

Solr 3.5 – Wildcard search as SQL LIKE

1

The Solr schema.xml has by default the “string” fieldType.

<fieldType name="string" class="solr.StrField" sortMissingLast="true" />

Add the following fieldType to your schema.xml and use it as field type for your field:

<fieldType name="string_rev" class="solr.TextField" sortMissingLast="true">     <analyzer type="index">         <tokenizer class="solr.KeywordTokenizerFactory"/>         <filter class="solr.LowerCaseFilterFactory" />         <filter class="solr.PatternReplaceFilterFactory" pattern="(\s+)" replacement="" replace="all" />         <filter class="solr.ReversedWildcardFilterFactory" />  

More >

Solr 3.5 – Search case insensitive on a string field for exact match

6

Solr has by default in the schema.xml the field type “string” available.

<!-- The StrField type is not analyzed, but indexed/stored verbatim. --> <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>

With this field type you can search with a string to get an exact match, instead of a contains match that the “text_general” field type will give you. However another difference is that the “text_general” field type is case insensitive by default and “string” is case sensitive.

To perform an case insensitive exact match search, you’ll have to add a custom field type More >

Solr 3.5 – Stop words are not removed

3

At http://wiki.apache.org/solr/LanguageAnalysis stop word files can be downloaded for several languages. Also the one for the English language is more extended than the default one shipped with Solr.

However if you enable them with the solr.StopFilterFactory the stop words still are not removed. This is caused by the “|” pipe characters after each word. Solr wants every word on a new line without anything else. Also replacement of | to # doesn’t work. This problem can be hard to discover if you expect that information provided by the Solr website should just work.

So to still contain the More >

Solr 3.5 – Multiple stop word files

1

As of Solr version 1.3 it’s possible to use multiple stop word files. You can define multiple files comma seperated like this:

<filter class="solr.StopFilterFactory" ignoreCase="true"    words="stopwords_en.txt,stopwords_nl.txt"    enablePositionIncrements="true" />
Go to Top