Improved search filtering (#940)
* Filter search by collectionId
* Improve spec, remove recursive import
* Add userId filter for documents.search
* 💚
* Search filter UI
* WIP UI
* Date filtering
Prevent dupe menu
* Refactor
* button
* Added year option, improved hover states
* Add new indexes
* Remove manual string interpolation in SQL construction
* Move dateFilter validation to controller
* Fixes: Double query when changing filter
Fixes: Visual jump between filters in dropdown
* Add option to clear filters
* More clearly define dropdowns in dark mode
* Checkbox -> Checkmark
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
// @flow
|
||||
import { observable, action, computed, runInAction } from 'mobx';
|
||||
import { without, map, find, orderBy, filter, compact, uniq } from 'lodash';
|
||||
import {
|
||||
without,
|
||||
map,
|
||||
find,
|
||||
orderBy,
|
||||
filter,
|
||||
compact,
|
||||
omitBy,
|
||||
uniq,
|
||||
} from 'lodash';
|
||||
import { client } from 'utils/ApiClient';
|
||||
import naturalSort from 'shared/utils/naturalSort';
|
||||
import invariant from 'invariant';
|
||||
@@ -225,8 +234,10 @@ export default class DocumentsStore extends BaseStore<Document> {
|
||||
query: string,
|
||||
options: PaginationParams = {}
|
||||
): Promise<SearchResult[]> => {
|
||||
// $FlowFixMe
|
||||
const compactedOptions = omitBy(options, o => !o);
|
||||
const res = await client.get('/documents.search', {
|
||||
...options,
|
||||
...compactedOptions,
|
||||
query,
|
||||
});
|
||||
invariant(res && res.data, 'Search response should be available');
|
||||
|
||||
Reference in New Issue
Block a user