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

0.7.11: Can't add array of documents to Document index #237

Closed
stefandesu opened this issue Jun 29, 2021 · 1 comment
Closed

0.7.11: Can't add array of documents to Document index #237

stefandesu opened this issue Jun 29, 2021 · 1 comment

Comments

@stefandesu
Copy link

The documentation says: "Just pass the document array (or a single object) to the index". However, that doesn't seem to work for me:

const { Document } = require("flexsearch")

const document = new Document({
  index: ["content"]
})

const docs = [
  {
    id: 1,
    content: "Hello world"
  },
  {
    id: 2,
    content: "What's up?"
  }
]

// this does not work (no results)
// document.add(docs)

// this does work (one result)
docs.forEach(doc => document.add(doc))

console.log(document.search("hello"))
@ts-thomas
Copy link
Contributor

Sorry, the documentation was not updated on this line. You can't add an array of items anymore, you need to add them one by one.

salim-b added a commit to salim-b/flexsearch that referenced this issue Aug 11, 2023
This was referenced Aug 11, 2023
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

No branches or pull requests

2 participants