diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 11:19:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:07:37 +0000 |
commit | b485aab7e71c1625cfc27e0f92c9509f42378458 (patch) | |
tree | ae9abe108601079d1679194de237c9a435ae5b55 /src/web/server/h2o/libh2o/misc/oktavia/test/test-oktavia-stemming.jsx | |
parent | Adding upstream version 1.44.3. (diff) | |
download | netdata-b485aab7e71c1625cfc27e0f92c9509f42378458.tar.xz netdata-b485aab7e71c1625cfc27e0f92c9509f42378458.zip |
Adding upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/web/server/h2o/libh2o/misc/oktavia/test/test-oktavia-stemming.jsx')
-rw-r--r-- | src/web/server/h2o/libh2o/misc/oktavia/test/test-oktavia-stemming.jsx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/web/server/h2o/libh2o/misc/oktavia/test/test-oktavia-stemming.jsx b/src/web/server/h2o/libh2o/misc/oktavia/test/test-oktavia-stemming.jsx new file mode 100644 index 000000000..d8d1d74eb --- /dev/null +++ b/src/web/server/h2o/libh2o/misc/oktavia/test/test-oktavia-stemming.jsx @@ -0,0 +1,55 @@ +import "test-case.jsx"; +import "oktavia.jsx"; +import "metadata.jsx"; +import "stemmer/english-stemmer.jsx"; +import "console.jsx"; + +class _Test extends TestCase +{ + var oktavia : Oktavia; + var section : Section; + + override function setUp () : void + { + this.oktavia = new Oktavia(); + this.oktavia.setStemmer(new EnglishStemmer()); + this.section = this.oktavia.addSection('document'); + this.oktavia.addWord("stemming baby", true); + this.section.setTail("doc1"); + this.oktavia.addWord("stemmed babies", true); + this.section.setTail("doc2"); + this.oktavia.build(); + } + + function test_search_without_stemming () : void + { + var results = this.oktavia.rawSearch('baby', false); + this.expect(results.length).toBe(1); + } + + function test_search_with_stemming () : void + { + var results = this.oktavia.rawSearch('baby', true); + this.expect(results.length).toBe(1); + } + + function test_load_dump_and_search_without_stemming () : void + { + var dump = this.oktavia.dump(); + var oktavia = new Oktavia(); + oktavia.setStemmer(new EnglishStemmer()); + oktavia.load(dump); + var results = oktavia.rawSearch('baby', false); + this.expect(results.length).toBe(1); + } + + function test_load_dump_and_search_with_stemming () : void + { + var dump = this.oktavia.dump(); + var oktavia = new Oktavia(); + oktavia.setStemmer(new EnglishStemmer()); + oktavia.load(dump); + var results = oktavia.rawSearch('baby', true); + this.expect(results.length).toBe(1); + } +} |