Serach by letters rather than words
-
Hi
how can i set search form to search by letters rather than search by a complete word.
also anything it should search with related keywords.. in topic/post/users/categories tags default.
-
nodebb-plugin-dbsearch
uses mongodb$text
and it doesn't support searching with letter prefixes AFAIK. You might need to build a custom search plugin. Although it does perform some stemming to match words that end with-ed
-ing
etc. https://www.mongodb.com/docs/manual/reference/operator/query/text/#stemmed-wordsThe quick search dropdown only searches in topic titles, you might be able to extend that by using a client side hook like
action:search.quick.complete
, performing the other searches(user, tag etc.) and adding the results into the same dropdown. -
In lieu of building your own, you can also take a look at some existing plugins integrating with an external search backend.
- nodebb-plugin-meilisearch is (AFAIK) the newest search plugin, for one of the newer search backends Prefix search works just fine, but as was mentioned quick search is titles-only. It still needs a bit more of my love, since it was built for a fairly old prerelease Meilisearch version, so there are some new features it could take advantage of (e.g. multi-index searches), and it could do with some better handling of configuration issues, but if your instance is configured correctly it should work fine.
- nodebb-plugin-solr is an older one, but should still work (I think). It might require removing the
less
style (which is actually not used at all), I'm not sure if NodeBB just ignores it or throws an error during build (I think ignores, so it should just work) - nodebb-plugin-elasticsearch now that's an old one (and a fork with some fixes at that), but it might still work (I think the relevant APIs haven't changed)...
Note that for all of them you need to first set up the relevant search backend (Meilisearch/Solr/Elasticsearch).