Книга: Apache Solr Search Patterns
Назад: The eDisMax query parser
Дальше: Building a custom query parser

Using BRS queries instead of DisMax

Now that we know the internals of how DisMax queries work and how scoring happens in Solr, let's look at creating our own query syntax and parser for customizing our search. The question here is what is missing in eDisMax. Note that eDisMax provides a simple search syntax where we do not have to worry about the fields and the results are sorted by relevance. However, suppose the requirement is exactly opposite. The end user is an advanced user who knows the fields and what he or she is searching for. One such example is a search involving patents. The syntax for such a search is specified by BRS. In addition to Fielded and Boolean search, BRS also provides a proximity search with clauses such as SAME (in the same paragraph), WITH (in the same sentence), ADJ (adjacent with order), and NEAR (adjacent without order), along with parenthetical grouping. An example of a BRS query is as follows:

((galaxy ADJ samsung) SAME note) AND (mobile OR tablet)

BRS provides a rich search syntax generally devoid of facets, synonyms, stemming, and even relevancy sorting. Solr's eDisMax query syntax does not provide us with a very rich position-aware query syntax. BRS, on the other hand, is all about positions of words. We will creating our own Solr plugin for handling position-aware queries.

Назад: The eDisMax query parser
Дальше: Building a custom query parser

Solr
Testing
dosare
121