- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用上下文建议器,我想知道我们是否可以设置用于建议的上下文范围,而不是使用所有上下文。
目前查询需要匹配所有上下文。我们能否在上下文中添加“或”运算和/或指定用于特定查询的上下文?
以here为例:映射:
PUT /venues/poi/_mapping
{
"poi" : {
"properties" : {
"suggest_field": {
"type": "completion",
"context": {
"type": {
"type": "category"
},
"location": {
"type": "geo",
"precision" : "500m"
}
}
}
}
}
}
然后我索引一个文档:
{
"suggest_field": {
"input": ["The Shed", "shed"],
"output" : "The Shed - fresh sea food",
"context": {
"location": {
"lat": 51.9481442,
"lon": -5.1817516
},
"type" : "restaurant"
}
}
}
查询:
{
"suggest" : {
"text" : "s",
"completion" : {
"field" : "suggest_field",
"context": {
"location": {
"value": {
"lat": 51.938119,
"lon": -5.174051
}
}
}
}
}
}
如果我只使用一个上下文(上例中的“位置”)进行查询,则会出错,我需要传递两个上下文,是否可以指定使用哪个上下文?或者将类似“Context_Operation”的参数设置为“OR”。
最佳答案
你有两个选择:
首先,您将所有可用类型值添加为映射中的默认值(不可扩展)
{
"poi" : {
"properties" : {
"suggest_field": {
"type": "completion",
"context": {
"type": {
"type": "category",
"default": ["restaurant", "pool", "..."]
},
"location": {
"type": "geo",
"precision" : "500m"
}
}
}
}
}
}
第二个选项,你为每个索引文档添加一个默认值,并且你只添加这个值作为默认值
映射:
{
"poi" : {
"properties" : {
"suggest_field": {
"type": "completion",
"context": {
"type": {
"type": "category",
"default": "any"
},
"location": {
"type": "geo",
"precision" : "500m"
}
}
}
}
}
}
文档:
{
"suggest_field": {
"input": ["The Shed", "shed"],
"output" : "The Shed - fresh sea food",
"context": {
"location": {
"lat": 51.9481442,
"lon": -5.1817516
},
"type" : ["any", "restaurant"]
}
}
}
关于Elasticsearch context suggester,bool on contexts,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29842492/
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
我的计算机上安装了 SE JDK 1.8.0_45。我希望编译器的源版本和目标版本都是 1.7。 我在 gradle 中做到了这一点,但我不知道如何在 IntelliJ IDEA 14.1.3(社区版
我正致力于根据以前成功搜索中使用的术语在我们的搜索应用程序(使用 Solr)中提供自动建议功能。在 Solr 建议文档 ( http://wiki.apache.org/solr/Suggester
我想过滤来自我的建议者的自动完成结果 假设我有一张书 table Table (Id Guid, BookName String, BookOwner id) 我希望每个用户都能从自己的书中获得一个自
你好 Stack Overflow 的人。我想就以下问题提出一些建议。我正在使用 Java。 我有一个包含多个字符串的数组#1。例如,其中两个字符串可能是:“一个苹果落在牛顿的头上”和“苹果长在树上”
当有人使用我的应用程序时,我想关闭在软/虚拟键盘上显示“建议的单词”(仅在某些 Activity 上)。对于默认的 Android 键盘,可以在“设置”下(在 Word Suggestion Sett
我正在尝试在 Solr 上使用自动完成功能,我找到的方法是使用 Solr Suggester .但是,它没有按预期工作。如果有人调用 http://localhost:8983/solr/techpr
Google建议如何工作?根据遥远的Google数据库中的信息,它如何快速地更新客户端上的网页?如果网页经常更新,为什么页面看起来不“跳动”? 最佳答案 它使用AJAX。 当您编写查询时,它会搜索与您
每当我运行 Build & Reload来自 RStudio 的 Build Pane ,我收到消息 ==> Rcmd.exe INSTALL --no-multiarch rwiots Err
几天来,我正在使用 NetBeans 6.8 进行 PHP 工作。 但是即使包含一个类文件并且方法是公共(public)的并且使用了 phpDoc,NetBeans 每次都会在窗口中显示“No Sug
我不知道我在这里使用的术语是否正确。然而,这就是我想要实现的目标,我想就如何实现这一目标提出一些建议。我想要一个可见边框的圆圈。现在这是困难的部分,我什至不知道如何开始。我想以这样一种方式来操纵圆圈,
我即将开发一个处理极其有值(value)的数据的应用程序。如果用户丢失这些数据,代价将非常高昂,因此我有兴趣了解更多有关满足我们需求的最佳架构设计的信息。 用户每天都会在 iPhone 中输入这些数据
wiki page of the Solr Suggester component没有提到如何搜索提供的字段?仅是前缀,还是也可以进行中缀搜索? 最佳答案 是的,支持。编辑你的 solrconfig.
我创建了一个新的 Azure 搜索建议器,但使用以下代码实现了模糊搜索: ISearchIndexClient indexClient = CreateSearchIndexClient(); var
是否可以让 Elasticsearch 完成建议程序按排序顺序返回结果?我正在遵循 this Elasticsearch blog post 中的示例并增加了额外的酒店: {"name": "Merc
我无法借助 search:suggest 函数提供这个简单的自动完成功能。 基于 Marklogic 演示数据中的奥斯卡语料库,我尝试提供一个建议查询,例如,即使用户当前正在写入“Robert Lo”
这是用 C 语言编写的 CGI 程序的一部分。当客户端单击链接时,我希望开始下载文件,并使用建议的默认文件名。 我知道规范明确指出 Content-disposition header 中指定的文件名
我正在尝试将谷歌建议链接到我的网站。我认为我正在使用的链接或我尝试读取文件的方式可能有问题。无论如何,这是我在我的 php 文件中使用的链接和代码 $filehandle=fopen("http://
我正在寻找一个不错的模板引擎或一小段代码来扩展 Java 字符串中类似 Ant 的变量。示例: String result = expand ("${firstName} ${familyName}"
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 8年前关闭。 Improve this que
我是一名优秀的程序员,十分优秀!