Trim search queries
This commit is contained in:
parent
a72adb0e75
commit
00cfea7f4e
@ -4,12 +4,11 @@ import {
|
|||||||
ElementRef,
|
ElementRef,
|
||||||
ViewChildren,
|
ViewChildren,
|
||||||
QueryList,
|
QueryList,
|
||||||
HostListener,
|
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core'
|
} from '@angular/core'
|
||||||
import { Router } from '@angular/router'
|
import { Router } from '@angular/router'
|
||||||
import { NgbDropdown, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbDropdown, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { Subject, debounceTime, distinctUntilChanged, filter } from 'rxjs'
|
import { Subject, debounceTime, distinctUntilChanged, filter, map } from 'rxjs'
|
||||||
import {
|
import {
|
||||||
FILTER_HAS_CORRESPONDENT_ANY,
|
FILTER_HAS_CORRESPONDENT_ANY,
|
||||||
FILTER_HAS_DOCUMENT_TYPE_ANY,
|
FILTER_HAS_DOCUMENT_TYPE_ANY,
|
||||||
@ -77,8 +76,9 @@ export class GlobalSearchComponent implements OnInit {
|
|||||||
this.queryDebounce
|
this.queryDebounce
|
||||||
.pipe(
|
.pipe(
|
||||||
debounceTime(400),
|
debounceTime(400),
|
||||||
distinctUntilChanged(),
|
map((query) => query?.trim()),
|
||||||
filter((query) => !query?.length || query?.length > 2)
|
filter((query) => !query?.length || query?.length > 2),
|
||||||
|
distinctUntilChanged()
|
||||||
)
|
)
|
||||||
.subscribe((text) => {
|
.subscribe((text) => {
|
||||||
this.query = text
|
this.query = text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user