Also this is strange, I put num_typos to 2 and Roc...
# community-help
s
Also this is strange, I put num_typos to 2 and Roche is considered a match using the query "chews" (i checked distance is 4)
k
🤔 Is "Roche" highlighted? Also, please try on v0.20 RC to see if the same behavior exists.
s
yes roche was highlighted
and no other term is close
message has been deleted
but I will check against v20
k
Thanks.
s
The following improved: matches that contain the query are listed first, but I still get a lot of random results
e.g. Sachets is matched, Lachesca
k
Can you please create a test collection and index just that record and repeat the query and see if the record is returned?
s
yes it does
Copy code
from typing import List

from external_services.typesense_cloud import typesense_client

from database_connection import db
import models as m

schema = {
    'name':
        'test',
    'fields':
        [
            {
                'facet': False,
                'name': 'id',
                'optional': False,
                'type': 'string'
            },
            {
                'facet': False,
                'name': 'name',
                'optional': False,
                'type': 'string'
            },
        ],
}


def bootstrap_data():
    # typesense_client.collections['test'].delete()
    typesense_client.collections.create(schema)

    products: List[m.Product] = db.session.query(m.Product).all()


    documents = [{"id": "1", "name": "Roche"}]
    typesense_client.collections['test'].documents.import_(documents, {'action': 'upsert', 'batch_size': 100})
    # typesense_client.collections['ingredients_v2'].documents.import_(documents, {'action': 'create'})


# bootstrap_data()

# res = typesense_client.collections['test'].retrieve()
# pprint(res)
search_requests = {
    'searches': [{
        'collection': 'test',
        'q': 'chews',
    }, ]
}

res = typesense_client.multi_search.perform(search_requests, {
    'query_by': 'name',
})

print(res)
maybe I am running the wrong version (typesense/typesense:0.20.0.rc44) but the highlighting issue seems to still be there as well
k
Which highlighting issue?
s
that some words are not highlighted
• Ensure that all queried fields are highlighted in search response
message has been deleted
query: la roche posay cicaplast
k
Yes that's still a work in progress. Which is why we haven't yet released 0.20 yet. Some last mile issues left to be addressed.
s
ah okay cool, sorry thought it's done already
k
No worries, if you can help me do a quick test: can you again index just this one record where highlight fails and tell me if the same issue occurs when querying for a single record?
This will greatly help me frame the test cases which I can then directly fix. In case this turns out to be another edge case different from what I've noticed before.
s
not sure if I got it correctly, but I deleted the collection, reindex just this one product
if I do that: Highlighting works
k
Yeah so it only fails when queried with other records. Got it. I will be looking into this for this release.
👍 1