Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
1.83 kB
import { connectHighlight } from 'react-instantsearch-core';
import Highlight from '../components/Highlight';
/**
* Renders any attribute from a hit into its highlighted form when relevant.
*
* Read more about it in the [Highlighting results](guide/Highlighting_results.html) guide.
* @name Highlight
* @kind widget
* @propType {string} attribute - location of the highlighted attribute in the hit (the corresponding element can be either a string or an array of strings)
* @propType {object} hit - hit object containing the highlighted attribute
* @propType {string} [tagName='em'] - tag to be used for highlighted parts of the hit
* @propType {string} [nonHighlightedTagName='span'] - tag to be used for the parts of the hit that are not highlighted
* @propType {node} [separator=',<space>'] - symbol used to separate the elements of the array in case the attribute points to an array of strings.
* @themeKey ais-Highlight - root of the component
* @themeKey ais-Highlight-highlighted - part of the text which is highlighted
* @themeKey ais-Highlight-nonHighlighted - part of the text that is not highlighted
* @example
* import React from 'react';
* import algoliasearch from 'algoliasearch/lite';
* import { InstantSearch, SearchBox, Hits, Highlight } from 'react-instantsearch-dom';
*
* const Hit = ({ hit }) => (
* <div>
* <Highlight attribute="name" hit={hit} />
* </div>
* );
*
* const searchClient = algoliasearch(
* 'latency',
* '6be0576ff61c053d5f9a3225e2a90f76'
* );
*
* const App = () => (
* <InstantSearch
* searchClient={searchClient}
* indexName="instant_search"
* >
* <SearchBox defaultRefinement="Pho" />
* <Hits hitComponent={Hit} />
* </InstantSearch>
* );
*/
export default connectHighlight(Highlight, { $$widgetType: 'ais.highlight' });