@empathyco/x-components
Version:
Empathy X Components
36 lines • 1.04 kB
TypeScript
/**
* Regex for splitting a query into its words.
*
* @public
*/
export declare const SPLIT_WORDS_REGEX: RegExp;
/**
* Compares two queries to know if the new one is a refined query from the previous one or a new
* one.
*
* A refined query is a query which has the previous query or part of it.
* Example:
* - previousQuery = 'lego star'.
* - newQuery = 'lego star wars'.
*
* Example:
* - previousQuery = 'lego star wars'.
* - newQuery = 'lego star'.
*
* A new query is a query which has not the previous query.
* Example:
* - previousQuery = 'lego star'.
* - newQuery = 'lego wars'.
*
* In this case, it is changing the word set, because a word is changed by another one, so
* this is changing the search intention.
*
* @param newQuery - The new query.
* @param previousQuery - The previous query.
*
* @returns A boolean which flags if the query is refined or not.
*
* @public
*/
export declare function isNewQuery(newQuery: string, previousQuery: string): boolean;
//# sourceMappingURL=is-new-query.d.ts.map