concept text analysis in category solr

appears as: text alysis, text alysis
Solr in Action

This is an excerpt from Manning's book Solr in Action.

Figure 1.3 depicted three main subsystems in Solr: document management, query processing, and text analysis. Of course, these are high-level abstractions for complex subsystems in Solr; we’ll learn about each one later in the book. Each system is composed of a modular “pipeline” that allows you to plug in new functionality. This means that instead of overriding the entire query-processing engine in Solr, you plug a new search component into an existing pipeline. This makes the core Solr functionality easy to extend and customize to meet your specific application needs.

In chapter 5, we learned how the Solr indexing process works and learned to define nontext fields in schema.xml. In this chapter, we get deeper into the indexing process by learning about text analysis.

Text analysis removes the linguistic variations between terms in the index and terms provided by users when searching, so that a user’s query for buying a new house can match a document titled purchasing a new home. In this chapter you’ll learn how to configure Solr to establish a match between queries containing house and documents containing home.

When done correctly, text analysis allows your users to query using natural language without having to think about all the possible forms of their search terms. You don’t want your users to have to construct queries like: buying house OR purchase home OR buying a home OR purchasing a house ...

Let’s continue with the example microblog search application we introduced in chapter 5. To recap, we’re designing and implementing a solution to search microblogs from popular social media sites like Twitter. Because the main focus of this chapter is on text analysis, let’s look closer at the text field in our example microblog document. Here is the text we want to analyze:

#Yummm :) Drinking a latte at Caffé Grecco in SF's historic North Beach...
Learning text analysis with #SolrInAction by @ManningBooks on my i-Pad

As we discussed in the introduction, a primary goal of text analysis is to allow your users to search using natural language without having to worry about all possible forms of their search terms. In figure 6.1, the user searched via the text field for San Francisco north beach coffee, which is a natural query to expect given all the great coffeehouses in North Beach; maybe our user is trying to find a great place to drink coffee in North Beach by searching social media content.

Our solution involves replacing one token, a shortened URL, with a different token, a fully resolved URL. Thus, for this requirement, it makes sense to build a custom TokenFilter, which is the most common and easiest way in Solr to customize text analysis. That said, you can also build your own analyzer, tokenizer, or char filter using a process similar to what we illustrate ahead.

Figure 9.6. Text analysis applied to a fictitious sighting by the text_en analyzer