Search query lifecycle
When a query is submitted to Funnelback it passes through a series of steps between the initial submission and when the final result is delivered to the end user.
This is known as the search lifecycle.
The search lifecycle represents the different states of the search data model between the submission of a query and return of corresponding search results. As the data model moves through the search lifecycle xit is updated. The search lifecycle consists of the following phases:
- Initialize data model
The data model is initialized with basic information based on the input parameters and configuration.
Different parts of the data model are initialized at different parts of the search lifecycle. See: Data model variable initialization for details on when various elements become available.
Executes pre-process plugin code or pre-process Groovy hook script code.
- Input processor
The user’s query terms and service/collection configuration is used to construct a question object within the search data model. This question object outlines the attributes that define the question that will be submitted to Funnelback’s query processor. This includes configuring faceted navigation.
- Extra searches setup
The question object is cloned for any extra searches that are configured to run as part of the overall search process.
- Pre-data fetch
Executes pre-data fetch plugin code or pre-data fetch Groovy hook script code.
- Results fetching
The question object is used to construct a query that is submitted to Funnelback’s query processor (padre). The query processor executes the query and performs an index lookup based on the attributes in the question object. This includes passing on the query constraints as well as configuration options that affect the display and ranking of the results.
- Post-data fetch
Executes post-data fetch plugin code or post-datafetch Groovy hook script code.
- Output processing
The raw XML response from the query processor is converted into a response object that is added to the data model. The output processing also builds many user interface objects such as the data structure behind faceted navigation.
Executes post-process plugin code or post-process Groovy hook script code.
- Results rendering
If Freemarker templating is applied to the results (i.e. the search is accessed via the HTML endpoint (
search.html)) then an additional phase transforms the final data model and produces formatted search results output based on the configured Freemarker templates. When integrating with the built-in JSON or XML endpoints (
search.xml) this final phase is implemented within the system that consumes the search results.
Understanding the state of the data model at every step in the process is critical when writing code that manipulates the data model. Elements within the data model are populated at different points in the search lifecycle. See: