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

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

* *

* HighlightBuilder has one mandatory attribute: *

* *

* HighlightBuilder also has some optional attributes: *

* * *

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

*
    *
  1. Get the HighlightBuilder
  2. *
  3. Add a highlighted field
  4. *
  5. Possibly set a char count
  6. *
  7. Possibly set pre + post
  8. *
  9. Do build
  10. *
*

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

*
    *
  1. Clear the highlighted fields
  2. *
  3. Possibly change char count
  4. *
  5. Possibly change pre + post
  6. *
  7. Do build
  8. *
*

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

*

 *    ## Get the builder
 *    #set ($searchFactory = $sitevisionUtils.searchFactory)
 *    #set ($highlightBuilder = $searchFactory.highlightBuilder)
 *
 *    ## Create a Highlight
 *    #set ($summaryHighlight = $highlightBuilder.addHighlightedField('summary').build())
 *
 *    ## Re-use the builder to create another Highlight
 *    #set ($nameHighlight = $highlightBuilder.clearHighlightedFields().addHighlightedField('name').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#getHighlightBuilder()}. * 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 HighlightBuilder extends Builder { /** * Adds a field that should be highlighted. * *

* Solr note: this is the 'hl.fl' param *

* @param aHighlightedField name of the field, a null or whitespace-only value will be ignored * @return this builder */ addHighlightedField(aHighlightedField: String | string): HighlightBuilder; /** * Removes all previously added highlighted fields. * @return this builder */ clearHighlightedFields(): HighlightBuilder; /** * Sets the number of chars that highlighted fragment should contain. * *

* If no char count is specified, the default value of the index config will be used (200). *

* *

* Solr note: this is the 'hl.fragsize' param *

* @param aCharCount the char count * @return this builder * @throws IllegalArgumentException if aCharCount is zero or negative */ setFragmentCharCount(aCharCount: number): HighlightBuilder; /** * Sets the start value for the highlighted section(s) of a fragment. * *

* If the pre string and post string are not specified, the default value of the index config will be used * ('<mark>' and '</mark>'). *

* *

* Solr note: this is the 'hl.simple.pre' param *

* @param aPreString a fragment start * @return this builder */ setFragmentPreString(aPreString: String | string): HighlightBuilder; /** * Sets the end value for the highlighted section(s) of a fragment. * *

* Note! The fragment pre value must match the fragment post string! * E.g: if the pre string is "<em>", the post string would typically be "</em>". *

* *

* Solr note: this is the 'hl.simple.post' param *

* @param aPostString a fragment end * @return this builder */ setFragmentPostString(aPostString: String | string): HighlightBuilder; /** * Creates a Highlight component instance using currently specified state/behaviour. * @return a Highlight component * @throws IllegalStateException if no highlighted field is specified, or if pre and post strings doesn't match (e.g. one of them is null) */ build(): Highlight; } declare namespace HighlightBuilder {} declare var highlightBuilder: HighlightBuilder; export default highlightBuilder;