Skip to content

Commit

Permalink
only search for 3+ characters on full-text or when button pressed + doc
Browse files Browse the repository at this point in the history
Signed-off-by: GRBurst <[email protected]>
  • Loading branch information
GRBurst committed May 26, 2024
1 parent d8f48f2 commit 73d63c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/components/CustomFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ interface SearchFilterProps {
const SearchFilter = ({ onTextSearch }: SearchFilterProps) => {
const { Search } = Input;
const onSearchInput: SearchProps['onSearch'] = (value) => {
if (value.length >= 3) {
if (value.length > 0) {
onTextSearch(value)
} else if (value.length == 0) {
onTextSearch(undefined)
Expand All @@ -73,7 +73,7 @@ const SearchFilter = ({ onTextSearch }: SearchFilterProps) => {
placeholder="case-sensitve input search text"
allowClear
onSearch={onSearchInput}
onChange={(e) => { if (e.target.value.length >= 3) { onTextSearch(e.target.value) } }}
onChange={(e) => { (e.target.value.length >= 3) ? onTextSearch(e.target.value) : onTextSearch(undefined) }}
enterButton
/>
)
Expand All @@ -87,7 +87,7 @@ const CustomFilters = ({ onTagAdd, onSearch }: CustomFiltersProps) => {

return (
<Flex gap="middle" vertical>
<p>Only simple regex without subgroup matching are supported. Including subgroups "(...)" might result in unexpected highlight behavior.</p>
<p>Only simple regex without subgroup matching are supported. Including subgroups "(...)" might result in unexpected highlight behavior. Full-text search is only applied on change for 3+ characters, or when the search button is pressed.</p>
<CustomTagFilter onTagAdd={onTagAdd} />
<SearchFilter onTextSearch={onSearch} />
</Flex>
Expand Down

0 comments on commit 73d63c8

Please sign in to comment.