Text analysis takes place in two phases, during index time and during query time. So we need to configure <analyzer> for both phases, distinguished by the type attribute. In the preceding example, we have configured a single <analyzer> element along with tokenizers and filters and not specified the type attribute. So Solr will apply the same configurations for the both phases (index and query). This type of configuration is required for some scenarios, say if we want to match strings exactly.
It is always advisable to define two separate <analyzer> for each phase distinguished by a type attribute. Doing so is required in some scenarios where we want to apply some steps at query time but not index time. For example: