/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { String } from "../../types/java/lang/String"; import type { Filter } from "../../types/senselogic/sitevision/api/search/searcher/component/Filter"; import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder"; /** *

* Builder for creating a {@link senselogic.sitevision.api.search.searcher.component.Filter} component with specific behaviour. *

* *

* FilterBuilder has one mandatory attribute: *

* * *

* Using the FilterBuilder is pretty straightforward, if you remember that it is stateful. Conceptually you * would typically use it like this: *

*
    *
  1. Get the FilterBuilder
  2. *
  3. Add a filter query
  4. *
  5. Possibly add another filter query
  6. *
  7. ...
  8. *
  9. Do build
  10. *
*

* When you have built a Filter instance, you can re-use the FilterBuilder to build more instances. Typically like: *

*
    *
  1. Clear the filter queries
  2. *
  3. Add a filter query
  4. *
  5. Possibly add another filter query
  6. *
  7. ...
  8. *
  9. Do build
  10. *
*

* Example of how this strategy could be implemented in Velocity: *

*

 *    ## Get the builder
 *    #set ($searchFactory = $sitevisionUtils.searchFactory)
 *    #set ($filterBuilder = $searchFactory.FilterBuilder)
 *
 *    ## Create a Filter
 *    #set ($nameMustStartWithAndersFilter = $filterBuilder.addFilterQuery('+name:Anders*').build())
 *
 *    ## Re-use the builder to create another Filter
 *    #set ($nameMustContainMagnusFilter = $filterBuilder.clearFilterQueries().addFilterQuery('+name.analyzed:magnus*').build())
 *  
* *

* Tip! The {@link senselogic.sitevision.api.base.Builder Builder interface documentation} contains * more information about Builders and how to work with them! *

* *

* An instance of the Sitevision class implementing this interface can be obtained via * {@link senselogic.sitevision.api.search.SearchFactory#getFilterBuilder()}. * See {@link senselogic.sitevision.api.search.SearchFactory} for how to obtain an instance of the SearchFactory interface. *

* @author Magnus Lövgren * @since Sitevision 3.6 */ export interface FilterBuilder extends Builder { /** * Adds a filter query. * *

* Solr note: this is the 'fq' param *

* *

* Query syntax note! Query strings should be expressed according to the Solr query syntax. * The syntax is basically the * * Lucene query syntax with some minor differences (solr syntax allows open-ended range queries and pure negative queries). * Also note that a general recommendation is to always use the prefix operators (+/-) instead of the * boolean keywords (AND/OR/NOT) to avoid unexpected behaviour. For deeper understanding, see for example * Why Not AND, OR, And NOT?. *

* @param aFilterQuery the filter query, a null or whitespace-only value will be ignored * @return this builder */ addFilterQuery(aFilterQuery: String | string): FilterBuilder; /** * Removes all previously added filter queries. * @return this builder */ clearFilterQueries(): FilterBuilder; /** * Creates a Filter component instance using currently specified state/behaviour. * @return a filter component * @throws IllegalStateException if no filter query exist */ build(): Filter; } declare namespace FilterBuilder {} declare var filterBuilder: FilterBuilder; export default filterBuilder;