concept indexing in category solr

appears as: indexing, indexing, n indexing
Relevant Search: With applications for Solr and Elasticsearch

This is an excerpt from Manning's book Relevant Search: With applications for Solr and Elasticsearch.

Because we know that we’re dealing with a search engine, we can be more specific about the steps in search’s ETL process. As illustrated in figure 2.5, these steps are extraction, enrichment, analysis, and indexing. Here, extraction is the process of retrieving the documents from their sources. The optional step of enrichment adds information to the documents useful for relevance. Analysis, as you saw earlier in this chapter, converts document text or data into tokens that enable matching. And finally, indexing is the process of placing data into those data structures.

Figure 2.5. The full search ETL pipeline: extraction, enrichment, analysis, and indexing

We cover extraction and enrichment rather generically. Many times, the details of these steps depend entirely on how your source data is stored. Indexing concerns us only as it pertains to enabling/disabling features for enabling relevance. Analysis, however, has overriding importance to search relevance and is expounded on here. It’s also discussed at several points throughout the book. Recall, analysis transforms raw text and data from the documents into tokens. These tokens represent the document’s features. Engineering these to match features from a user’s query is critical to satisfy the user’s information need.

Solr in Action

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

Let’s assume you have four shards for your index, and the server hosting shard2 loses power. At this point, Solr can’t continue indexing documents and can’t service queries, so your search engine is effectively down. To avoid this situation, you can add replicas of each shard. In this case, when shard2 fails, Solr reroutes indexing and query traffic to the replica, and your Solr cluster remains online. The result of this failure is that indexing and queries can still be processed, but they may not be as fast because you have one less server to handle requests. We’ll discuss failover scenarios in chapters 12 and 13.

  • Configure Solr to apply transformations to the text in the document during indexing.
  • Listing 5.4. Representing multivalued fields in XML during indexing

    In section 5.2.2, we discussed that it’s a good idea to make your documents uniquely identifiable in the index using a unique ID value. To recap, if you provide a unique identifier field for each of your documents, Solr will avoid creating duplicates during indexing. In addition, if you plan to distribute your Solr index across multiple servers, you must provide a unique identifier for your documents. For these reasons, we recommend defining a unique identifier for your documents from the start. In our microblog example, the id field is unique, so we configure Solr to use that field as the unique key for documents using the <uniqueKey> element in schema.xml.

    Listing 5.9. The <uniqueKey> element identifies the unique ID field for documents
    <uniqueKey>id</uniqueKey>

    One thing to note is that it’s best to use a primitive field type, such as string or long, for the field you indicate as being the <uniqueKey/> as that ensures Solr doesn’t make any changes to the value during indexing. We’ve seen instances in which Solr doesn’t return results correctly if you don’t use string as the type for text-based keys. Save yourself some trouble and use string or one of the other primitive field types for your unique key field.

    5.5. Sending documents to Solr for indexing

    We now have enough background on the indexing process to begin adding documents to Solr. In this section, we learn how to send documents to Solr for indexing and get a glimpse of what happens behind the scenes. At the end of this section, you’ll be able to start indexing documents to Solr from your application. Let’s begin by learning how to index the example tweets we’ve been working with in this chapter.