This project gives you a Solr filter, packaged in a jar, that can be dropped into your Solr's lib directory. Once deployed, it will take ISO-639-1 and ISO-639-2 codes in Solr fields and turn them into their English equivalents (for instance, 'en' becomes 'English' and 'afr' becomes 'Afrikaans').

The filter gives you a nice, human-friendly, way to facet on the language codes in your metadata. It doesn't actually change the values in the stored field (if the field's data is stored), but just adds an English text version of the ISO-639 code to the index.

The idea for this project came from Nick Ruest. He mentioned the idea in the #islandora IRC channel, and I thought it sounded like a good idea, so I implemented it. It seems like a pretty easy win for folks working with Solr and metadata that uses ISO-639 codes.

Using Solr-ISO639-Filter


To use Solr-ISO639-Filter in a Maven-based project, reference it in your project's pom.xml file.

<dependency>
  <groupId>info.freelibrary</groupId>
  <artifactId>solr-iso639-filter</artifactId>
  <version></version>
</dependency>


Or, to use it with Gradle/Grails, include the following in your project's build.gradle file:

compile 'info.freelibrary:solr-iso639-filter:'


You can also configure the use of the library for earlier version of Solr. For instance, for a Maven-based project:

<dependency>
  <groupId>info.freelibrary</groupId>
  <artifactId>solr-iso639-filter</artifactId>
  <version></version>
</dependency>


Or, for a Gradle/Grails-based project:

compile 'info.freelibrary:solr-iso639-filter:'

If you want to download a pre-built jar file to manually put into your Solr's lib directory, visit the download page.

Building Solr-ISO639-Filter


If you'd like to build the project yourself, you'll need a current JDK and Maven installed and added to your system path. You can then download a stable release or clone the project using Git. To clone the project, type:

git clone https://github.com/ksclarke/solr-iso639-filter.git
cd solr-iso639-filter


To build the project, type:

mvn install


This will build the filter for the latest version of Solr supported by this project.

If you want to build for another version of Solr, you can supply that version as an argument to the build; for instance:

mvn -Dsolr.version=4.2.0 install


or

mvn -Dsolr.version=3.6.2 install


This should work for any of the supported versions of Solr (versions 3.6.1 through ). It may also work with other versions of Solr. Feel free to experiment even if your version of Solr isn't in the supported range.

To build the project's documentation, type:

mvn javadoc:javadoc


For more information (including how to configure the filter), consult the "Docs" dropdown in the navigation menu at the top of the page.