A collection of examples demonstrating how to use a variety of Lucidworks Fusion Query Pipeline stages.

Additional Query Parameters

The Additional Query Parameters stage can modify search results by setting, appending and removing Solr parameters from an incoming search request.

Sort

Sort results from A to Z on the title field. Note the title field must be added to the Solr schema as a lowercase field type.

Parameter Name / Parameter Value / Update Policy
sort title_sort asc append

Hit Highlighting

Use hl and hl.fl parameters to show search query string in title and description fields of search results. Note the title and description fields must be added to the Solr schema as a text_general field type, rather than a string field type. Multiple fields can be specified in the hl.fl parameter value if separated with a comma.

Parameter Name / Parameter Value / Update Policy
hl true default
hl.fl title_txt,description_txt default

Filter

Use a filter query fq to return a specific set of results. Note the Parameter Value understands OR is the same as ||.

Parameter Name / Parameter Value / Update Policy
fq _lw_data_source_s:Gallery-TopReports_ClinicalQuality append
fq _lw_data_source_s:(Gallery-TopReports_Revenue OR Gallery-TopReports_Finance) append
fq _lw_data_source_s:Gallery* || _lw_data_source_s:*Reports_Insights || _lw_data_source_s:*Reports_Vantage append

Use a filter query to remove items from a set of search results - in this case remove all results that originate from the System-Messages datasource connector.

Parameter Name / Parameter Value / Update Policy
fq -_lw_data_source_s:System-Messages append

Conditional Filter

To activate a filter stage ONLY when specific request conditions are true or false, add a condition statement. This example first tests an incoming query request for a "gallery-id" parameter, and if the  
"gallery-id" parameter contains the string "gallery_clinicalquality," then it filters search results by the contents of a specific datasource connector.

Condition
request.hasParam('gallery-id') && request.getParam('gallery-id').contains('gallery_clinicalquality')

Parameter Name / Parameter Value / Update Policy
fq _lw_data_source_s:Gallery-TopReports_ClinicalQuality append