8000 searching Chinese doesn't yield results even in simple cases · Issue #2085 · typesense/typesense · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
searching Chinese doesn't yield results even in simple cases #2085
Open
@dannylin108

Description

@dannylin108

Description

Search is not working with this simple configuration:

const testData = [
    {
        lvl0: "Zhuang Zi",
        lvl1: "Chapter 2",
        content: "昔者莊周夢為胡蝶,栩栩然胡蝶也。自喻適志與,不知周也。俄然覺,則蘧蘧然周也,不知周之夢為胡蝶與,胡蝶之夢為周與?周與胡蝶,則必有分矣。此之謂物化。",
        url: "/zhuangzi-2#p269",
        url_without_anchor: "/zhuangzi-2",
        item_priority: 100,
        comment: false,
    }
]

const indexName = "zhuangzi-2";

const schema: CollectionCreateSchema = {
    name: indexName,
    fields: [
        { name: "lvl0", type: "string" },
        { name: "lvl1", type: "string" },
        { name: "content", type: "string", locale: "zh" }, // <--- !!!!
        { name: "url", type: "string" },
        { name: "url_without_anchor", type: "string" },
        { name: "item_priority", type: "int32" },
        { name: "comment", type: "bool" },
    ],
}; 


async function main() {
    await typesenseClient.collections().create(schema);
    await typesenseClient.collections(indexName).documents().import(testData);

    const searchResult = await typesenseClient
        .collections(indexName)
        .documents()
        .search({
            q: "蝶",
            query_by: "content",
        });
    console.log(searchResult.hits);
}

main();

Steps to reproduce

Repo for reproduction

https://github.com/dannylin108/typesense-bug-report

Expected Behavior

Should find the only document, which actually contains the character we were looking for.

Actual Behavior

Result is []

Metadata

Typesense Version: 0.27.1

OS: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0