- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我正在构建的索引中,我对运行查询感兴趣,然后(使用构面)返回该查询的带状疱疹。这是我在文本上使用的分析器:
{
"settings": {
"analysis": {
"analyzer": {
"shingleAnalyzer": {
"tokenizer": "standard",
"filter": [
"standard",
"lowercase",
"custom_stop",
"custom_shingle",
"custom_stemmer"
]
}
},
"filter": {
"custom_stemmer" : {
"type": "stemmer",
"name": "english"
},
"custom_stop": {
"type": "stop",
"stopwords": "_english_"
},
"custom_shingle": {
"type": "shingle",
"min_shingle_size": "2",
"max_shingle_size": "3"
}
}
}
}
}
主要问题是,在 Lucene 4.4 中,停止过滤器不再支持 enable_position_increments
参数来消除包含停用词的 shingles。相反,我会得到这样的结果......
“红色和黄色”
"terms": [
{
"term": "red",
"count": 43
},
{
"term": "red _",
"count": 43
},
{
"term": "red _ yellow",
"count": 43
},
{
"term": "_ yellow",
"count": 42
},
{
"term": "yellow",
"count": 42
}
]
自然地,这极大地扭曲了返回的带状疱疹的数量。在 Lucene 4.4 之后有没有一种方法可以在不对结果进行后处理的情况下管理它?
最佳答案
可能不是最佳解决方案,但最直接的方法是向您的分析器添加另一个过滤器以杀死“_”填充标记。在下面的示例中,我将其称为“kill_fillers”:
"shingleAnalyzer": {
"tokenizer": "standard",
"filter": [
"standard",
"lowercase",
"custom_stop",
"custom_shingle",
"custom_stemmer",
"kill_fillers"
],
...
将“kill_fillers”过滤器添加到您的过滤器列表中:
"filters":{
...
"kill_fillers": {
"type": "pattern_replace",
"pattern": ".*_.*",
"replace": "",
},
...
}
关于elasticsearch - 在 Elasticsearch 和 Lucene 4.4 中使用 Shingles 和停用词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27410253/
我正在尝试使用 Solr 在用户搜索 (例如,“blue skinny jeans”中的“skinny jeans”)中找到完全匹配的类别。我正在使用以下类型定义:
我有一个与 shingleAnalyzer 相关的问题,我想创建搜索词的 shingles,同时将它们提供给 lucene 进行搜索 String term = "new york"; String[
我有以下文件: 南非 北非 我想从以下位置检索我的“南非”文档: 非洲 (a) 南非 (b) 非洲 (c) 我定义了以下过滤器和分析器: POST test_index { "settings":
我目前正在使用 lucene 索引网页。目的是能够快速提取哪个页面包含某个表达式(通常是 1、2 或 3 个词),以及页面中还包含哪些其他词(或其中的 1 到 3 个词组)。这将用于构建/丰富/更改词
实现类似 Google 的自动完成的方法之一是在 Solr 1.4 中结合 shingles 和 termvector 组件。 首先,我们使用 shingles 组件生成所有 n-gram 分布,然后
我正在使用 SOLR 5.2 构建应用程序,我需要这种类型的匹配: 如果我存储了字段名称:“bla1 bla2”和名称:“bla2 some bla3”当我查询诸如名称之类的内容时:“某事bla1 b
我需要实现w-shingling (Java 中)比较两个 html 文档的相似性。问题是如何收集和储存木瓦。我们假设 (a,rose,is,a,rose,is,a,rose) 是这些文档之一。我想我
我们有一个符合 OData 的 API,可以将部分全文搜索需求委托(delegate)给 Elasticsearch 集群。 由于 OData 表达式可能变得非常复杂,因此我们决定将它们简单地转换为等
我在 Django 应用程序中使用 Elasticsearch 进行全文搜索。我正在使用 pypi 中的 elastic_dsl 库与集群交互。我正在尝试在分析器中实现瓦状过滤器。我相信我已经让它使用
如何称呼 Python DSL 中的带状疱疹? 这是一个简单的示例,在“姓名”字段中搜索一个短语,在“姓氏”字段中搜索另一个短语。 import json from elasticsearch imp
我将 lucene 4.4 版与这些分析器一起使用: worddelimeter, patternFilter, synonyms, lowercase, stopwords, kStemFilter
在我正在构建的索引中,我对运行查询感兴趣,然后(使用构面)返回该查询的带状疱疹。这是我在文本上使用的分析器: { "settings": { "analysis": { "an
我是一名优秀的程序员,十分优秀!