Skip to content

Tolerance disables prefix search #544

@flodiebold

Description

@flodiebold

Describe the bug

Usually e.g. Chris matches Christopher, but setting tolerance to 1 makes it not match anymore. I'm not sure whether this is intentional, but it's at least surprising.

To Reproduce

      const db = await create({
        schema: {
          name: 'string',
        } as const,
        components: {
          tokenizer: {
            stemming: true,
            stopWords: englishStopwords,
          },
        },
      })

      await insert(db, { name: "Christopher" })
      const result = await search(db, { term: 'Chris', tolerance: 1 })
      // result should contain the document, but does not

Expected behavior

Ideally I'd like to be able to search with tolerance and allow matching prefixes.

Environment Info

Orama 2.0.0-beta.4

Affected areas

Search

Additional context

If it's not intentional, I could look into fixing this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions