简体   繁体   中英

Is there any way of removing a defaultQuery

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM