Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Used Japanese tokenization in queries for accurate word searching in … #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

H3xano
Copy link

@H3xano H3xano commented Nov 15, 2024

Overview

This PR addresses the issue where searching for compound Japanese terms like "標準製品" did not return the expected matches in Lunr.js. The solution involves:

Japanese Morphological Segmentation: Utilizes the lunr.ja plugin to ensure consistent tokenization of Japanese text during both indexing and querying.

Wildcard Query Enhancement: Appends trailing wildcards (*) to each token in the search query to enable partial and prefix matching.

Error Handling: Ensures that queries are constructed using Lunr's query builder API to prevent parsing errors and maintain consistency.

Changes Made

  • Reintroduced the lunr.ja plugin for accurate Japanese tokenization.
  • Modified the Search component to tokenize queries using the same pipeline.
  • Utilized Lunr's query builder API to construct searches programmatically, ensuring error-free query execution.

@strogonoff
Copy link
Collaborator

There was no need to convert from ESM to CJS… And it makes checking the changes more difficult ;) @H3xano

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.

2 participants