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

Lyra don't creates nodes for multiple nested props #154

Closed
mateonunez opened this issue Oct 13, 2022 · 1 comment · Fixed by #157
Closed

Lyra don't creates nodes for multiple nested props #154

mateonunez opened this issue Oct 13, 2022 · 1 comment · Fixed by #157
Assignees

Comments

@mateonunez
Copy link
Collaborator

Describe the bug
With #17 Lyra implemented the support of nested properties. The implementation works fine if there is only 1 nested property in the schema. Adding more objects in the schema, the nodes are not inserted properly at the root level.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Lyra project and paste the following code:
import { create, insert, search } from "@lyrasearch/lyra";

const lyra = create({
  schema: {
    email: 'string',
    name: { first: 'string', last: 'string' },
    login: { username: 'string', password: 'string' },
  },
})

insert(lyra, {
  email: 'one@two.three',
  name: { first: 'four', last: 'five' },
  login: { username: 'six', password: 'seven' },
})

const results = search(lyra, {
  term: 'six'
})

console.log(results)

Expected behavior
Everything looks good when searching for the values four and five, but the searching value belongs to the second block of nested properties (login), the results are empty.

Searching four as a term:

{
  hits: [
    {
      id: '70308384-5',
      email: 'one@two.three',
      name: [Object], // Found here
      login: [Object]
    }
  ],
  term: 'four'
}

Searching six as a term:

{ hits: [], term: 'six' }

Screenshots

These are the last elements of the nodes prop:

image

Desktop (please complete the following information):

  • Node v18.10.0
  • Lyra v0.2.6
@github-actions
Copy link

🎉 This issue has been resolved in version 0.2.7 🎉

The release is available on:

Your optic bot 📦🚀

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 a pull request may close this issue.

1 participant