@empathyco/x-components
Version:
Empathy X Components
81 lines (38 loc) • 1.38 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [isNewQuery](./x-components.isnewquery.md)
## isNewQuery() function
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.
**Signature:**
```typescript
export declare function isNewQuery(newQuery: string, previousQuery: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
newQuery
</td><td>
string
</td><td>
The new query.
</td></tr>
<tr><td>
previousQuery
</td><td>
string
</td><td>
The previous query.
</td></tr>
</tbody></table>
**Returns:**
boolean
A boolean which flags if the query is refined or not.