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

Stemming does not work for non-english locale #1665

Open
lockie opened this issue Apr 11, 2024 · 0 comments
Open

Stemming does not work for non-english locale #1665

lockie opened this issue Apr 11, 2024 · 0 comments
Labels

Comments

@lockie
Copy link

lockie commented Apr 11, 2024

Description

Stemming does not seem to work for non-english locale (specifically, russian one). Search results on a big corpus of text are entirely different for the adjective "доверенное" and for the "доверенные" (same adjective, plural form). Snowball demo correctly recognizes the base form of those adjectives.

Steps to reproduce

mkdir data
export TYPESENSE_API_KEY='some-key'
export TYPESENSE_HOST='http://localhost:8108'
typesense-server --data-dir=$(pwd)/data&
curl "${TYPESENSE_HOST}/collections" \
      -X POST \
      -H "Content-Type: application/json" \
      -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
        "name": "posts",
        "enable_nested_fields": true,
        "fields": [
          {"name": "text", "type": "string", "locale": "ru", "stem": true }
        ]
      }'
curl "${TYPESENSE_HOST}/collections/posts/documents" \
        -X POST \
        -H "Content-Type: application/json" \
        -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
        -d '{
          "text": "доверенное"
        }'
curl "${TYPESENSE_HOST}/collections/posts/documents" \
        -X POST \
        -H "Content-Type: application/json" \
        -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
        -d '{
          "text": "доверенные"
        }'
curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
     "${TYPESENSE_HOST}/collections/posts/documents/search?query_by=text&q=доверенное"

Expected Behavior

Both documents matched.

Actual Behavior

Only single document is matched:

{"facet_counts":[],"found":1,"hits":[{"document":{"id":"0","text":"доверенное"},"highlight":{"text":{"matched_tokens":["доверенное"],"snippet":"<mark>доверенное</mark>"}},"highlights":[{"field":"text","matched_tokens":["доверенное"],"snippet":"<mark>доверенное</mark>"}],"text_match":578730123365711993,"text_match_info":{"best_field_score":"1108091339008","best_field_weight":15,"fields_matched":1,"num_tokens_dropped":0,"score":"578730123365711993","tokens_matched":1,"typo_prefix_score":0}}],"out_of":2,"page":1,"request_params":{"collection_name":"posts","first_q":"доверенное","per_page":10,"q":"доверенное"},"search_cutoff":false,"search_time_ms":1}

Metadata

Typesense Version: 26.0

OS: Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants