【问题标题】:Django Wagtail elastic search 2.4 ascii foldingDjango Wagtail 弹性搜索 2.4 ascii 折叠
【发布时间】:2017-05-24 16:04:54
【问题描述】:

是否可以在 Wagtail elasticsearch 2.4 搜索后端设置 ascii 折叠,例如搜索“Nimes”会返回带有“Nîmes”索引的对象?

我尝试添加以下设置:

WAGTAILSEARCH_BACKENDS = {
    'default': {
        'BACKEND': 'app.search.backend',
        'URLS': ['http://search:9200'],
        'INDEX': 'wagtail',
        'TIMEOUT': 5,
        'INDEX_SETTINGS': {
            'settings': {
                'analysis': {
                    'analyzer': {
                        'ngram_analyzer': {
                            'type': 'custom',
                            'tokenizer': 'lowercase',
                            'filter': ['asciifolding', 'ngram']
                        },
                        'edgengram_analyzer': {
                            'type': 'custom',
                            'tokenizer': 'lowercase',
                            'filter': ['asciifolding', 'edgengram']
                        },
                        "folding": {
                            "tokenizer": "standard",
                            "filter": ["lowercase", "asciifolding"]
                        }
                    }
                }
            }
        }
    }
}

但它不起作用。 我在 Django 1.10.7 和 Python 3.5.2 上使用 Wagtail 1.9。

【问题讨论】:

    标签: django python-3.x elasticsearch wagtail


    【解决方案1】:

    我假设app.search.backend 继承自Elasticsearch2SearchBackend?如果是这样,wagtail 1.9 中 ES 搜索后端的默认设置已经进行了 ASCII 折叠。 See relevant code in wagtail.

    【讨论】:

    • 它是,但即使没有更改设置中的任何内容,它似乎也不会执行 ASCII 折叠。我需要以其他方式启用它吗?
    猜你喜欢
    • 1970-01-01
    • 2021-11-23
    • 2017-06-19
    • 1970-01-01
    • 2020-12-20
    • 1970-01-01
    • 1970-01-01
    • 2019-05-02
    • 1970-01-01
    相关资源
    最近更新 更多