seald / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser
MIT License
351 stars 32 forks source link

Support text indexing and search #42

Closed bacloud23 closed 9 months ago

bacloud23 commented 1 year ago

Is your feature request related to a problem? Please describe. I don't know if it is possible to index English text and search for it. (except using regex, which is not practical for user searches)

This has been raised https://github.com/louischatriot/nedb/issues/640 so I assume it is not supported.

Describe the solution you'd like Same as Mongo, the possibility to full search text, like:

collection.createIndex({ title: 'text' }) // with or without weights is fine I think { weights: { title: 3 } }

query.$text = { $search: phrase }

collection.find(query, { score: { $meta: 'textScore' } })

Describe alternatives you've considered I don't have an alternative at this point other than using regex , it is hard and inpracticale.

tex0l commented 9 months ago

Unfortunately no, it is not available in NeDB. If you want to implement it, I would be open to looking at a PR.

I'm closing for now.