@botonic/plugin-contentful
Version:
## What Does This Plugin Do?
25 lines (24 loc) • 1.11 kB
TypeScript
import * as cms from '../cms';
import { PagingOptions } from '../cms';
import { KeywordsOptions, MatchType, NormalizedUtterance, Normalizer, Word } from '../nlp';
import { SearchResult } from './search-result';
export declare class SearchByKeywords {
readonly cms: cms.CMS;
readonly normalizer: Normalizer;
readonly keywordsOptions: {
[locale: string]: KeywordsOptions;
};
constructor(cms: cms.CMS, normalizer: Normalizer, keywordsOptions?: {
[locale: string]: KeywordsOptions;
});
/**
* It will assign a score based on the ratio of the matched substring length wit respect to the input length
*/
searchContentsFromInput(inputText: NormalizedUtterance, matchType: MatchType, context: cms.ContextWithLocale, paging?: PagingOptions): Promise<SearchResult[]>;
/**
* Chitchat contents need special treatment: does not make sense to ask user to disambiguate,
* have less priority than non-chitchat contents,...
* @return which contents must be displayed
*/
filterChitchat(words: Word[], results: SearchResult[]): SearchResult[];
}