简体   繁体   English

有什么办法可以删除defaultQuery

[英]Is there any way of removing a defaultQuery

I've extended the searchBox component to provide amongst my own render function. 我扩展了searchBox组件以在我自己的渲染函数中提供。 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. 例如,如果我将'title', ['foo', 'bar']作为道具传递给我的searchBox组件,则我希望搜索结果不包含标题为foo或bar的匹配。

For this i'm using addDefaultQuery as following 为此,我正在使用addDefaultQuery如下

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. addDefaultQuery不是为此设计的。 Have a look at setQueryProcessor in docs http://docs.searchkit.co/stable/core/SearchkitManager.html 在文档http://docs.searchkit.co/stable/core/SearchkitManager.html中查看setQueryProcessor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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