Skip to content

Commit

Permalink
Allow toggling filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Dec 19, 2022
1 parent c766959 commit 198145f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion searchlib/components/SearchView/DefaultContentView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const DefaultContentView = (props) => {

return (
<>
<FilterList />
{appConfig.showFilters && <FilterList />}
{appConfig.enableNLP ? <AnswerBox /> : ''}
<div className="above-results">
<ViewSelectorWithLabel
Expand Down
38 changes: 20 additions & 18 deletions searchlib/components/SearchView/FilterAsideContentView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,28 @@ export const FilterAsideContentView = (props) => {
return (
<>
<ActiveFilterList />
<SectionTabs />
{appConfig.showFilters && <SectionTabs />}
<div className={`results-layout ${layoutMode}`}>
<div className="above-results">
<div className="above-left">
<DropdownFacetsList />
{appConfig.showFilters && (
<div className="above-results">
<div className="above-left">
<DropdownFacetsList />
</div>
<div className="above-right">
<Component factoryName="SecondaryFacetsList" {...props} />
<Sorting
label={''}
sortOptions={sortOptions}
view={SortingDropdownWithLabel}
/>
{/* <ViewSelectorWithLabel */}
{/* views={availableResultViews} */}
{/* active={activeViewId} */}
{/* onSetView={setActiveViewId} */}
{/* /> */}
</div>
</div>
<div className="above-right">
<Component factoryName="SecondaryFacetsList" {...props} />
<Sorting
label={''}
sortOptions={sortOptions}
view={SortingDropdownWithLabel}
/>
{/* <ViewSelectorWithLabel */}
{/* views={availableResultViews} */}
{/* active={activeViewId} */}
{/* onSetView={setActiveViewId} */}
{/* /> */}
</div>
</div>
)}

{children.length === 0 && !isLoading && wasSearched && <NoResults />}

Expand Down
2 changes: 2 additions & 0 deletions searchlib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ const config = {
showPromptQueries: true,
defaultPromptQueries: [], // offered as possible queries, in a prompt below text input. One per line
promptQueryInterval: 20000,
alwaysSearchOnInitialLoad: false, // used in elastic search driver
showFilters: true, // enables the filters interface, to allow falling back to just a simple results list

// highlight: {
// queryParams: {
Expand Down
7 changes: 7 additions & 0 deletions src/SearchBlock/templates/SearchResultsView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ SearchResultsView.schemaEnhancer = ({ schema }) => {
schema.fieldsets[0].fields.unshift(
'defaultResultView',
'alwaysSearchOnInitialLoad',
'showFilters',
);
schema.properties.alwaysSearchOnInitialLoad = {
title: 'Autoload results',
type: 'boolean',
default: true,
configPath: 'alwaysSearchOnInitialLoad',
};
schema.properties.showFilters = {
title: 'Show filters?',
type: 'boolean',
default: true,
configPath: 'showFilters',
};

return schema;
};

0 comments on commit 198145f

Please sign in to comment.