1

I've extended the searchBox component to provide amongst my own render function. I want to send a list of attributes of which the search-query should add negations on.

For example if I pass 'title', ['foo', 'bar'] as props to my searchBox component i want the search result to not include hits with title: foo or bar.

For this i'm using addDefaultQuery as following

this.context.searchkit.addDefaultQuery(query =>
  query.addQuery(BoolMustNot([{ match: { [attribute]: value } }])),
)

Is there any way of removing an added query once added?

1 Answers1

0

addDefaultQuery isn't designed for this. Have a look at setQueryProcessor in docs http://docs.searchkit.co/stable/core/SearchkitManager.html

Marcus Ekström
  • 410
  • 6
  • 11
  • i am using next.js and i want to reload setQueryProcessor in dynamic route page ? how to do that? – Edmon Sep 26 '20 at 05:59