Time for action – selecting documents with the filter query

Sometimes, it's useful to be able to narrow the collection of documents on which we are currently performing our search. It is useful to add some kind of explicit linked condition on the logical side for navigation on data, and this will also have a good impact on performance too.

It is shown in the following example:

Time for action – selecting documents with the filter query

It shows how the default search is restricted by the introduction of a fq=annunciation condition.

What just happened?

The first result in this simple example shows that we obtain results similar to what we could have obtained by a simple q=annunciation search. We will have the chance to see the differences between the two options with more detail in Chapter 5, Extending Search. Filtered query can be cached (just like facets, which we will see later), improving the performance by reducing the overhead of performing the same query many times and accessing documents from large datasets to the same group many times.

Tip

In this case, the analogy with SQL seems less convincing; but q=dali and fq=abstract:painting can be seen corresponding to WHERE conditions in SQL. The fq parameters will then be a fixed condition.

For example, in our scenario, we could define specific endpoints with a predefined filter query by author to create specific channels. In this case, instead of passing the parameters every time we could set them on solrconfig.xml, as we will see later in the chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.82.217