/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { Filter } from "../../types/senselogic/sitevision/api/search/searcher/component/Filter"; import type { Highlight } from "../../types/senselogic/sitevision/api/search/searcher/component/Highlight"; import type { Node } from "../../types/javax/jcr/Node"; import type { Parser } from "../../types/senselogic/sitevision/api/search/searcher/component/Parser"; import type { Sort } from "../../types/senselogic/sitevision/api/search/searcher/component/Sort"; import type { SpellCheck } from "../../types/senselogic/sitevision/api/search/searcher/component/SpellCheck"; import type { Monitor } from "../../types/senselogic/sitevision/api/search/searcher/component/Monitor"; import type { PermissionCheck } from "../../types/senselogic/sitevision/api/search/searcher/component/PermissionCheck"; import type { Searcher } from "../../types/senselogic/sitevision/api/search/searcher/Searcher"; import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder"; /** *

* Builder for creating a {@link senselogic.sitevision.api.search.searcher.Searcher} with a specific setup of components. *

* *

* The following components can be set. All components are optional. *

* *

* What index to query can also be specified. Default is the default node index * (i.e. the main index with pages/images/files etc.). *

* *

* Example of how to use the SearchBuilder to create a Searcher in Velocity: *

*

 *    ## Get the search factory
 *    #set ($searchFactory = $sitevisionUtils.searchFactory)
 *
 *    ## Create a Filter component
 *    #set ($filterBuilder = $searchFactory.filterBuilder)
 *    #set ($filter = $filterBuilder.addFilterQuery('metadata.category:responsive').build())
 *
 *    ## Create a Highlight component
 *    #set ($highlightBuilder = $searchFactory.highlightBuilder)
 *    #set ($highlight = $highlightBuilder.addHighlightedField('summary').build())
 *
 *    ## Create a Sort component
 *    #set ($lastPublishedSort = $searchFactory.getSearchSortField('lastpublished', true))
 *    #set ($sortBuilder = $searchFactory.sortBuilder)
 *    #set ($sort = $sortBuilder.addSortField($lastPublishedSort).build())
 *
 *    ## Get the search builder
 *    #set ($searcherBuilder = $searchFactory.searcherBuilder)
 *
 *    ## Set all components and create the Searcher
 *    #set ($searcher = $searcherBuilder.setFilter($filter).setHighlight($highlight).setSort($sort).build())
 *
 *    ## Search and handle the result
 *    #set ($searchResult = $searcher.search('example*', 10))
 *    ...
 *  
* *

* 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#getSearcherBuilder()}. * 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 SearcherBuilder extends Builder { /** * Sets the filter component. * *

* A Filter instance is created via the {@link FilterBuilder#build()} method. *

* @param aFilter the filter component * @return this builder * @see FilterBuilder */ setFilter(aFilter: Filter): SearcherBuilder; /** * Sets the highlight component. * *

* A Highlight instance is created via the {@link HighlightBuilder#build()} method. *

* @param aHighlight the highlight component * @return this builder * @see HighlightBuilder */ setHighlight(aHighlight: Highlight): SearcherBuilder; /** * Sets the index to search in. * *

* Note! If no index is set, the Searcher that is constructed will use * the default node index (i.e. the main index with pages/images/files etc.). *

* *

* Tip! Use the {@link senselogic.sitevision.api.search.index.IndexUtil} utility to get an index. *

* @param anIndex the index * @return this builder * @throws IllegalArgumentException if anIndex isn't an index node (primary node type name should be sv:nodeIndex or sv:applicationIndex) */ setIndex(anIndex: Node): SearcherBuilder; /** * Sets the parser component. * *

* A Parser instance is created via the {@link ExtendedDismaxParserBuilder#build()} method * or the {@link StandardParserBuilder#build()} method. *

* *

* Note! If no Parser is set, the Searcher that is constructed will use a default multi-field * parser (that can be constructed via {@link ExtendedDismaxParserBuilder}). *

* @param aParser the parser component * @return this builder * @see ExtendedDismaxParserBuilder * @see StandardParserBuilder */ setParser(aParser: Parser): SearcherBuilder; /** * Sets the sort component. * *

* A Sort instance is created via the {@link SortBuilder#build()} method. *

* @param aSort the sort component * @return this builder * @see SortBuilder */ setSort(aSort: Sort): SearcherBuilder; /** * Sets the spell check (suggestions/did-you-mean) component. * *

* A SpellCheck instance is created via the {@link SpellCheckBuilder#build()} method. *

* @param aSpellCheck the spell check component * @return this builder * @see SpellCheckBuilder */ setSpellCheck(aSpellCheck: SpellCheck): SearcherBuilder; /** * Sets the monitor component. * *

* A Monitor instance is created via the {@link MonitorBuilder#build()} method. *

* @param aMonitor the monitor component * @return this builder * @see MonitorBuilder * @since Sitevision 4.1 */ setMonitor(aMonitor: Monitor): SearcherBuilder; /** * Sets the permission check component. * *

* Note! This component is only applicable when querying a Node index (sv:nodeIndex)! *

*

* When querying a Custom Node index that is populated with external data, you should typically set a permission check component * that specifies the {@link senselogic.sitevision.api.search.searcher.component.PermissionStrategy#EARLY_CHECK} strategy. *

*

* * Legacy: a Searcher without any PermissionCheck component will use a legacy default strategy when checking * permissions. This strategy is a mix of EARLY_CHECK and LATE_CHECK that is kept as-is for legacy reasons only. * New search solutions with Searcher should typically specify a PermissionCheck component when querying * a sv:nodeIndex. * *

*

* A PermissionCheck instance is created via the {@link PermissionCheckBuilder#build()} method. *

* @param aPermissionCheck the permission check component * @return this builder * @see PermissionCheck * @since Sitevision 2023.09.1 */ setPermissionCheck(aPermissionCheck: PermissionCheck): SearcherBuilder; /** * Creates a Searcher instance using currently specified components. * @return a Searcher instance */ build(): Searcher; } declare namespace SearcherBuilder {} declare var searcherBuilder: SearcherBuilder; export default searcherBuilder;