olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.89k stars 548 forks source link

id has a length limit? #398

Closed btopro closed 5 years ago

btopro commented 5 years ago

having trouble tracking this down but I have a key 4 items with keys like this:

[
  {
    "id": "123-123-123d",
    "title": "Lunr",
    "text": "Like Solr, but much smaller, and not as bright. mega"
  },
  {
    "id": "123-2222-123d",
    "title": "React",
    "text": "A JavaScript library popular among mega corporaMega Corp."
  },
  {
    "id": "123-123-ddddd",
    "title": "Lodash",
    "text": "A modern JavaScript utility library delivering modularity, peld."
  },
  {
    "id": "ed7d34ba4a1234123dfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfs",
    "title": "Google Login",
    "text": "We here at PY4E use Google Accounts as our sole d"
  }
]

Item 4 can't be found not matter what. If I reduce the id length to like ed7d34ba4a12 then it finds it. Is there a limit to the id length?

yeraydiazdiaz commented 5 years ago

I've put together a fiddle with your example documents and the last document is returned as expected in the results.

Maybe the error is in the code around the parsing of the results?

btopro commented 5 years ago

huh, ok, good to know. I've found that I can't have IDs longer then 29 characters so maybe it is something in what I'm reviewing. Thanks for confirming this isn't a thing on lunr's end :) -- fyi made a web component version of searching -- https://www.npmjs.com/package/@lrnwebcomponents/lunr-search