mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
search index: don't stemm words that would be excluded from search index only after stemming #1529
This commit is contained in:
@@ -58,6 +58,7 @@ def assert_lang_agnostic_key_words(searchindex):
|
||||
assert 'thisnoteith' not in searchindex
|
||||
assert 'thisonetoo' in searchindex
|
||||
|
||||
|
||||
@with_app(testroot='search')
|
||||
def test_meta_keys_are_handled_for_language_en(app, status, warning):
|
||||
os.remove(app.outdir / 'searchindex.js')
|
||||
@@ -68,6 +69,7 @@ def test_meta_keys_are_handled_for_language_en(app, status, warning):
|
||||
assert 'onlygerman' not in searchindex
|
||||
assert 'thistoo' in searchindex
|
||||
|
||||
|
||||
@with_app(testroot='search', confoverrides={'html_search_language': 'de'})
|
||||
def test_meta_keys_are_handled_for_language_de(app, status, warning):
|
||||
app.builder.build_all()
|
||||
@@ -75,4 +77,17 @@ def test_meta_keys_are_handled_for_language_de(app, status, warning):
|
||||
assert_lang_agnostic_key_words(searchindex)
|
||||
assert 'onlygerman' in searchindex
|
||||
assert 'notgerman' not in searchindex
|
||||
assert 'onlytoogerman' in searchindex
|
||||
assert 'onlytoogerman' in searchindex
|
||||
|
||||
|
||||
@with_app(testroot='search')
|
||||
def test_stemmer_does_not_remove_short_words(app, status, warning):
|
||||
app.builder.build_all()
|
||||
searchindex = (app.outdir / 'searchindex.js').text()
|
||||
assert 'zfs' in searchindex
|
||||
|
||||
|
||||
@with_app(testroot='search')
|
||||
def test_stemmer(app, status, warning):
|
||||
searchindex = (app.outdir / 'searchindex.js').text()
|
||||
assert 'findthisstemmedkei' in searchindex
|
||||
|
||||
Reference in New Issue
Block a user