Add all search parameters

This commit is contained in:
Stanislav Romanov 2022-10-23 12:00:18 +03:00
parent cc3a340321
commit 4c8ca3a714
3 changed files with 50 additions and 22 deletions

View file

@ -9,10 +9,20 @@ export default class AdminIndexesItemDocumentsIndexController extends Controller
@service router;
@tracked q = '';
@tracked limit = 20;
@tracked offset = 0;
@tracked limit = 20;
@tracked filter = null;
@tracked facets = null;
@tracked attributesToRetrieve = ['*'];
@tracked attributesToCrop = null;
@tracked cropLength = 10;
@tracked cropMarker = '…';
@tracked attributesToHighlight = null;
@tracked highlightPreTag = '<em>';
@tracked highlightPostTag = '</em>';
@tracked showMatchesPosition = false;
@tracked sort = null;
@tracked attributesToRetrieve = [];
@tracked matchingStrategy = 'last';
@tracked hiddenFields = [];
@tracked dataView = 'table';
@ -20,7 +30,23 @@ export default class AdminIndexesItemDocumentsIndexController extends Controller
@tracked isAdvancedSearch = false;
@tracked errors;
queryParams = ['q', 'limit', 'offset', 'sort', 'attributesToRetrieve'];
queryParams = [
'q',
'offset',
'limit',
'filter',
'facets',
'attributesToRetrieve',
'attributesToCrop',
'cropLength',
'cropMarker',
'attributesToHighlight',
'highlightPreTag',
'highlightPostTag',
'showMatchesPosition',
'sort',
'matchingStrategy',
];
Magnify = Magnify;

View file

@ -35,7 +35,7 @@ const searchSchema = {
sort: {
oneOf: [type('array').items('string'), type('null')],
},
matchingStrategy: type('string'),
matchingStrategy: { enum: ['last', 'all'] },
},
additionalProperties: false,
required: ['q'],

View file

@ -27,25 +27,27 @@
</div>
{{#if (eq this.mode 'advanced')}}
<Form::Element @errors={{this.errors}}>
<MonacoEditor
@value={{json-stringify this.searchObject}}
@language='json'
@uri={{@model.searchSchema.uri}}
@schema={{@model.searchSchema}}
@sendValue={{this.search}}
@invoker={{this.invoker}}
@onDidValidation={{set this 'errors'}}
/>
</Form::Element>
<div>
<Form::Element @errors={{this.errors}}>
<MonacoEditor
@value={{json-stringify this.searchObject}}
@language='json'
@uri={{@model.searchSchema.uri}}
@schema={{@model.searchSchema}}
@sendValue={{this.search}}
@invoker={{this.invoker}}
@onDidValidation={{set this 'errors'}}
/>
</Form::Element>
<Button
@text='Search'
@style='primary'
@onClick={{fn this.invoker.invoke 'invokeSendValue'}}
class='mb-4'
disabled={{or this.isValidating this.errors.length}}
/>
<Button
@text='Search'
@style='primary'
@onClick={{fn this.invoker.invoke 'invokeSendValue'}}
class='mb-4'
disabled={{this.errors.length}}
/>
</div>
{{else if (eq this.mode 'simple')}}
<div class='sm:flex sm:flex-nowrap'>
{{! q }}