Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 20, 2025

Replaces naive substring matching with Bleve (https://blevesearch.com/) for the search API endpoint.

Changes

  • Store: Added in-memory Bleve index, built during data load. Documents indexed with lowercased content using keyword analyzer for case-insensitive wildcard matching.

  • Search: Wildcard queries (*query*) replace linear scans. Maintains pagination, sheet filtering, and API contract.

  • Multi-Word Search: Query terms separated by spaces are combined with AND logic. For example, searching "悲伤 表情" (sad expression) will find text containing both "悲伤" AND "表情", such as "英雄可不能露出悲伤的表情啊".

  • Document IDs: Use |@| delimiter format (sheet|@|rowId|@|index) to handle rowIds containing underscores or special characters.

CJK Language Support

Keyword analyzer preserves full text without tokenization, enabling wildcard substring matching across Chinese, Japanese, and Korean:

// Single-word queries
/api/search?lang=ja&q=ブレード  // Japanese
/api/search?lang=chs&q=战斗    // Chinese  
/api/search?lang=en&q=blade    // English

// Multi-word queries (AND logic)
/api/search?lang=chs&q=悲伤%20表情  // Finds text with both terms
/api/search?lang=en&q=sad%20expression  // Finds text with both terms

Performance

Index-based search vs. O(n) iteration over all items. Relevant for larger datasets.

Original prompt

搜索部分接入 https://blevesearch.com/


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add Bleve search integration Integrate Bleve search engine for full-text search Dec 20, 2025
Copilot AI requested a review from oott123 December 20, 2025 14:14
@oott123
Copy link
Member

oott123 commented Dec 20, 2025

@copilot 加入分词,比如搜索“悲伤 表情” 的时候要能搜出 “英雄可不能露出悲伤的表情啊”

Copy link
Contributor Author

Copilot AI commented Dec 20, 2025

@copilot 加入分词,比如搜索“悲伤 表情” 的时候要能搜出 “英雄可不能露出悲伤的表情啊”

已实现。现在搜索 "悲伤 表情" 可以找到包含这两个词的文本(如 "英雄可不能露出悲伤的表情啊")。多个词用空格分隔,会使用 AND 逻辑匹配。

Commit: 075e799

Copilot AI changed the title Integrate Bleve search engine for full-text search Integrate Bleve search engine for full-text search with multi-word query support Dec 20, 2025
commit 075e799
Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Date:   Sat Dec 20 14:48:36 2025 +0000

    Remove redundant checks in multi-word search logic

    Co-authored-by: oott123 <905663+oott123@users.noreply.github.com>

commit bbf043d
Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Date:   Sat Dec 20 14:46:26 2025 +0000

    Add multi-word search support with term conjunction

    Co-authored-by: oott123 <905663+oott123@users.noreply.github.com>

commit 2bfa3ff
Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Date:   Sat Dec 20 14:13:31 2025 +0000

    Run go fmt to fix formatting

    Co-authored-by: oott123 <905663+oott123@users.noreply.github.com>

commit ddd2ca3
Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Date:   Sat Dec 20 14:12:18 2025 +0000

    Fix code review issues: remove unused variable and improve document ID parsing

    Co-authored-by: oott123 <905663+oott123@users.noreply.github.com>

commit 84eb95b
Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Date:   Sat Dec 20 14:08:59 2025 +0000

    Integrate Bleve search for better search performance

    Co-authored-by: oott123 <905663+oott123@users.noreply.github.com>

commit 673278c
Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Date:   Sat Dec 20 13:59:07 2025 +0000

    Initial plan
@zhyupe zhyupe force-pushed the copilot/add-bleve-search-integration branch from 075e799 to 746280b Compare December 20, 2025 15:36
@zhyupe zhyupe merged commit 746280b into main Dec 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants