It would be really useful if Tuesday and Tues could be stemmed to Tue, January to Jan, September and Sept to Sep etc. People do seem to search using these abbreviations and also sometimes use the abbreviated forms when entering content...

Or perhaps a form where you can enter your own custom stems... Could contain the above by default...

Comments

gpk’s picture

This should probably filed against 2.0 but I've not got round to trying it out yet... From what I can see from the details of the 2.0 algorithm, days of week and month names are not treated in a special way as I'm suggesting.

jhodgdon’s picture

Status: Active » Closed (works as designed)

The Porter Stemmer module implements the Porter Stemmer algorithm, which does not stem weeks and months (or anything else) to abbreviations.

A person could definitely write a search preprocessing module that would expand abbreviations in the search index, or "stem" things like weeks and months to abbreviations, but that is beyond the scope of the Porter Stemmer algorithm.

gpk’s picture

Thanks, would such a "search preprocessing module" (presumably Porter Stemmer is one such) be able to sit alongside/play nicely with Porter Stemmer itself, i.e. can you have multiple search preprocessing modules?

jhodgdon’s picture

It should work fine next to Porter Stemmer, since Porter Stemmer doesn't do anything with abbreviations or days/months.

And yes, Porter Stemmer is a search preprocessing module, in that its only function in Drupal is to pre-process text/keywords for Drupal's core search module. An abbreviation module would also implement Drupal's hook_search_preprocess(), and instead of calling the Porter Stemmer's stemming function, it would do a search/replace on the abbreviations.

If you are thinking of developing this module, I would make it language-independent, and give the user an option to add/remove things from the list of abbreviations to be substituted. I would also recommend expanding abbreviations during preprocessing (e.g. save Tuesday in the index if Tue is encountered), rather than the reverse (save Tue if Tuesday is encountered), to avoid running into word length issues.