Skip to content

Search Filter not working as expected #612

@Leo310

Description

@Leo310

Describe the bug

When I execute this code:

console.log('Filtering by sources', sources);
const results = await search(db, {
       where: {
            source: sources,
       },
       10000,
});
console.log('Got results', results);
}

I get the following console output:
image
As you can see the first hit in the results already has a different source attribute (value: "README.md") than the filter (value: "To Add.md").
The filter was completely ignored.

To Reproduce

  1. Initialize Orama as follows:
const recordManagerSchema = {
    id: 'string',
    source: 'string',
    updated_at: 'number',
} as const;

const db = await create({
            schema: recordManagerSchema,
            id: "testdb",
            components: {
                tokenizer: {
                    stemming: true,
                    stemmerSkipProperties: ['id', 'source'],
                },
            },
        });
  1. Insert some data into this db with different sources
  2. execute the code I already provided in the bug description

Expected behavior

As you stated in your docs:
image
I expect to only get hits that include 'To Add.md' in their source attribute.

Environment Info

OS: Mac 14.2.1
Orama: 2.0.1
Running inside Obsidian (electron app)

Affected areas

Search

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions