soderlind/norwegian-stopwords-searchwp4

Norwegian stopwords for SearchWP 4

1.1.1 2023-06-01 17:26 UTC

This package is auto-updated.

Last update: 2024-04-10 17:29:09 UTC


README

Want to autoactivate the default search index? I have a plugin that does that

Norwegian Stopwords for SearchWP 4

Norwegian, bokmål and nynorsk, stopwords are missing in SearchWP 4. This plugin will add them if your locale is no_NB or no_NN

add_filter( 'searchwp\stopwords', __NAMESPACE__ . '\stopwords' );

function stopwords( array $stopwords ) : array {
	$locale = strtolower( substr( get_locale(), 0, 2 ) );
	switch ( $locale ) {
		case 'nb':
		case 'nn':
			$default_stopwords = explode(
				',',
				_x(
					'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',
					'Comma-separated list of search stopwords in your language'
				)
			);

			return get_option( 'searchwp_stopwords', $default_stopwords );
		default:
			return $stopwords;
	}
}

Installation

You know the drill,

  • Download
  • Add to the plugins folder
  • Activate.

Credits

The stopwords are from the WordPress translation, bokmål and nynorsk.

Copyright and License

Norwegian Stopwords for SearchWP 4 is copyright 2023 Per Søderlind

Norwegian Stopwords for SearchWP 4 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

Norwegian Stopwords for SearchWP 4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Extension. If not, see http://www.gnu.org/licenses/.