【问题标题】:GAE Search API not normalizing search strings?GAE Search API 没有规范化搜索字符串?
【发布时间】:2013-11-02 22:51:06
【问题描述】:

当我使用 Search API 搜索某些内容时,我希望查询字符串被规范化(即重音字母会变成它们的非重音字母)。

因此,例如,如果我要搜索“azúcar”,搜索 API 将真正搜索“azucar”。

这是我的搜索处理程序代码:

index = search.Index(name='index', namespace='namespace')
    results = index.search(
        query=Query(
            query_string=search_query,
            options=QueryOptions(
                limit=10,
                cursor=Cursor(),
                sort_options=SortOptions(
                    match_scorer=search.RescoringMatchScorer()
                )
            )
        )
    )

搜索 API 真的会这样做吗?我是不是做错了什么?

提前致谢

【问题讨论】:

    标签: google-app-engine python-2.7 google-search-api


    【解决方案1】:

    搜索 API 不这样做;有关类似讨论,请参阅 Partial matching GAE search APIGAE Full Text Search: can only match exact word? how to search like contains(...)?

    在我的公司,我们已经实施了上述代币化方法,而且它似乎运作良好。解决问题的一种方法是在进行标记化时将其标准化为 ASCII。请参阅 What is the best way to remove accents in a Python unicode string? 了解相关操作方法。

    【讨论】:

    • 感谢您的参考。很有帮助。
    猜你喜欢
    • 2010-10-10
    • 1970-01-01
    • 2017-12-24
    • 2018-09-29
    • 2020-02-12
    • 2012-04-25
    • 1970-01-01
    • 2021-03-22
    • 1970-01-01
    相关资源
    最近更新 更多