PacktLib: Apache Solr 3.1 Cookbook

Apache Solr 3.1 Cookbook


About the Author

About the Reviewers


Apache Solr Configuration


Running Solr on Jetty

Running Solr on Apache Tomcat

Using the Suggester component

Handling multiple languages in a single index

Indexing fields in a dynamic way

Making multilingual data searchable with multicore deployment

Solr cache configuration

How to fetch and index web pages

Getting the most relevant results with early query termination

How to set up Extracting Request Handler

Indexing your Data


Indexing data in CSV format

Indexing data in XML format

Indexing data in JSON format

Indexing PDF files

Indexing Microsoft Office files

Extracting metadata from binary files

How to properly configure Data Import Handler with JDBC

Indexing data from a database using Data Import Handler

How to import data using Data Import Handler and delta query

How to use Data Import Handler with URL Data Source

How to modify data while importing with Data Import Handler

Analyzing your Text Data


Storing additional information using payloads

Eliminating XML and HTML tags from the text

Copying the contents of one field to another

Changing words to other words

Splitting text by camel case

Splitting text by whitespace only

Making plural words singular, but without stemming

Lowercasing the whole string

Storing geographical points in the index

Stemming your data

Preparing text to do efficient trailing wildcard search

Splitting text by numbers and non-white space characters

Solr Administration


Monitoring Solr via JMX

How to check the cache status

How to check how the data type or field behave

How to check Solr query handler usage

How to check Solr update handler usage

How to change Solr instance logging configuration

How to check the Java based replication status

How to check the script based replication status

Setting up a Java based index replication

Setting up script based replication

How to manage Java based replication status using HTTP commands

How to analyze your index structure

Querying Solr


Asking for a particular field value

Sorting results by a field value

Choosing a different query parser

How to search for a phrase, not a single word

Boosting phrases over words

Positioning some documents over others on a query

Positioning documents with words closer to each other first

Sorting results by a distance from a point

Getting documents with only a partial match

Affecting scoring with function

Nesting queries

Using Faceting Mechanism


Getting the number of documents with the same field value

Getting the number of documents with the same date range

Getting the number of documents with the same value range

Getting the number of documents matching the query and sub query

How to remove filters from faceting results

How to name different faceting results

How to sort faceting results in an alphabetical order

How to implement the autosuggest feature using faceting

How to get the number of documents that don't have a value in the field

How to get all the faceting results, not just the first hundred ones

How to have two different facet limits for two different fields in the same query

Improving Solr Performance


Paging your results quickly

Configuring the document cache

Configuring the query result cache

Configuring the filter cache

Improving Solr performance right after the startup or commit operation

Setting up a sharded deployment

Caching whole result pages

Improving faceting performance

What to do when Solr slows down during indexing when using Data Import Handler

Getting the first top documents fast when having millions of them

Creating Applications that use Solr and Developing your Own Solr Modules


Choosing a different response format than the default one

Using Solr with PHP

Using Solr with Ruby

Using SolrJ to query Solr

Developing your own request handler

Developing your own filter

Developing your own search component

Developing your own field type

Using Additional Solr Functionalities


Getting more documents similar to those returned in the results list

Presenting search results in a fast and easy way

Highlighting matched words

How to highlight long text fields and get good performance

Sorting results by a function value

Searching words by how they sound

Ignoring defined words

Computing statistics for the search results

Checking user's spelling mistakes

Using "group by" like functionalities in Solr

Dealing with Problems


How to deal with a corrupted index

How to reduce the number of files the index is made of

How to deal with a locked index

How to deal with too many opened files

How to deal with out of memory problems

How to sort non-English languages properly

How to deal with the infinite loop exception when using shards

How to deal with garbage collection running too long

How to update only one field in all documents without the need of full indexation

How to make your index smaller