generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new permanent filter, so we can exclude some documents from glo…
…bal search
- Loading branch information
Showing
2 changed files
with
42 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
import { getTodayWithTime } from '../utils'; | ||
|
||
export default { | ||
// filter values that are always added to the ES requests | ||
permanentFilters: [ | ||
{ term: { hasWorkflowState: 'published' } }, | ||
() => ({ | ||
constant_score: { | ||
filter: { | ||
bool: { | ||
should: [ | ||
{ | ||
bool: { | ||
must_not: { | ||
exists: { | ||
field: 'issued', | ||
}, | ||
function constantScore() { | ||
return { | ||
constant_score: { | ||
filter: { | ||
bool: { | ||
should: [ | ||
{ | ||
bool: { | ||
must_not: { | ||
exists: { | ||
field: 'issued', | ||
}, | ||
}, | ||
}, | ||
{ | ||
range: { 'issued.date': { lte: getTodayWithTime() } }, | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
range: { 'issued.date': { lte: getTodayWithTime() } }, | ||
}, | ||
], | ||
}, | ||
}, | ||
}), | ||
}, | ||
}; | ||
} | ||
constantScore.id = 'constantScore'; | ||
|
||
export default { | ||
// filter values that are always added to the ES requests | ||
permanentFilters: [ | ||
{ term: { hasWorkflowState: 'published' } }, | ||
constantScore, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters