Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/powersearch-value-only-matches-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
'@astryxdesign/core': patch
---

[feat] `PowerSearch`: in the sheet presentation, Add filter's content search lists the value-only matches of operators that set `isValueOnlyMatchAllowed` (`component:PowerSearch` FR30), after its other suggestions, at most three per field, with a "More {field} matching '{text}'" row after a field's rows when it has more. The list follows incremental search results, as the typeahead's does: the rows that need no source show at once, and a search-source field's rows join below them when its source answers, after the same 150 ms hold, with one call per distinct source. While a query waits on a source, the search shows its loading indicator and no empty state, and the result count is announced once, when the query settles. A "More" row opens the value step, carrying the typed text where the editor takes one (a text field's value, a search source's query, or the query a list value's Tokenizer sheet opens with); an `enum` or `enum_list` value lists in full. A people field's "More" row, where the first opted-in operator takes an `entity_list` value with a `searchSource`, opens that operator's Tokenizer sheet directly above Add filter, already searching the text; its Save adds the filter and shows Filters, and an empty Save or a dismissal returns to Add filter with the text kept.
[feat] `PowerSearch`: in the sheet presentation, Add filter's content search lists the value-only matches of operators that set `isValueOnlyMatchAllowed`, in a config that passes `valueOnlyMatches: powerSearchValueOnlyMatches` (`component:PowerSearch` FR30), after its other suggestions, at most three per field, with a "More {field} matching '{text}'" row after a field's rows when it has more. The list follows incremental search results, as the typeahead's does: the rows that need no source show at once, and a search-source field's rows join below them when its source answers, after the same 150 ms hold, with one call per distinct source. While a query waits on a source, the search shows its loading indicator and no empty state, and the result count is announced once, when the query settles. A "More" row opens the value step, carrying the typed text where the editor takes one (a text field's value, a search source's query, or the query a list value's Tokenizer sheet opens with); an `enum` or `enum_list` value lists in full. A people field's "More" row, where the first opted-in operator takes an `entity_list` value with a `searchSource`, opens that operator's Tokenizer sheet directly above Add filter, already searching the text; its Save adds the filter and shows Filters, and an empty Save or a dismissal returns to Add filter with the text kept.

@imdreamrunner
2 changes: 1 addition & 1 deletion .changeset/powersearch-value-only-matches.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
'@astryxdesign/core': patch
---

[feat] `PowerSearch`: an operator's new `isValueOnlyMatchAllowed: true` suggests its complete filters for a typed value alone, with no field label before it (`component:PowerSearch` FR27–FR29, DEC-8). Typing "fiction" offers `Genre is Fiction` after the field and field-and-operator rows: a `string` or `string_list` operator without a `searchSource` offers the typed text, an `enum` or `enum_list` operator the values with a word that starts with it (ignoring case and accents, whole-label matches first), and an operator with a `searchSource` the items that source returns. Each distinct source is asked once per query, once the text has rested 150 ms, and its rows append below the others. A field shows at most three of these rows from two characters (or its `typeaheadMinQueryLength`), with a "More {field} matching '{text}'" row after a field's rows when it has more, which opens that field's value editor, carrying the typed text into an editor that searches (an `enum` field's editor opens on its full list). They do not count toward `maxSearchResults`. The option is off by default, so a config that opts no operator in keeps every list as it is; a field's `isValueMatchAllowed: false` turns these rows off too, and an opt-in under it warns once in development.
[feat] `PowerSearch`: an operator's new `isValueOnlyMatchAllowed: true`, in a config that passes `valueOnlyMatches: powerSearchValueOnlyMatches` (imported from `@astryxdesign/core`), suggests its complete filters for a typed value alone, with no field label before it (`component:PowerSearch` FR27–FR29, DEC-8). Typing "fiction" offers `Genre is Fiction` after the field and field-and-operator rows: a `string` or `string_list` operator without a `searchSource` offers the typed text, an `enum` or `enum_list` operator the values with a word that starts with it (ignoring case and accents, whole-label matches first), and an operator with a `searchSource` the items that source returns. Each distinct source is asked once per query, once the text has rested 150 ms, and its rows append below the others. A field shows at most three of these rows from two characters (or its `typeaheadMinQueryLength`), with a "More {field} matching '{text}'" row after a field's rows when it has more, which opens that field's value editor, carrying the typed text into an editor that searches (an `enum` field's editor opens on its full list). They do not count toward `maxSearchResults`. The option is off by default, so a config that opts no operator in keeps every list as it is, and a page whose configs do not pass the matcher ships none of its code; an opt-in in a config without the matcher lists nothing and warns once in development; a field's `isValueMatchAllowed: false` turns these rows off too, and an opt-in under it warns once in development.

@imdreamrunner
6 changes: 5 additions & 1 deletion apps/storybook/stories/PowerSearch.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import React, {useState} from 'react';
import type {Meta, StoryObj} from '@storybook/react';
import {PowerSearch} from '@astryxdesign/core/PowerSearch';
import {
PowerSearch,
powerSearchValueOnlyMatches,
} from '@astryxdesign/core/PowerSearch';
import type {
PowerSearchConfig,
PowerSearchFilter,
Expand Down Expand Up @@ -1688,6 +1691,7 @@ const valueOnlySlowUserSource: SearchSource = {

const valueOnlyConfig: PowerSearchConfig = {
name: 'ValueOnlyMatches',
valueOnlyMatches: powerSearchValueOnlyMatches,
contentSearchFieldKey: 'title',
fields: [
{
Expand Down
Loading