From 748a7451eeec2132c51315854eecff66b4f84665 Mon Sep 17 00:00:00 2001 From: Michele Riva Date: Sat, 11 Jun 2022 10:44:55 +0200 Subject: [PATCH] docs(docs): adds explaination about input analyzer --- .../docs/src/.vuepress/components/Foo/Bar.vue | 15 ------- .../.vuepress/components/OtherComponent.vue | 3 -- .../.vuepress/components/demo-component.vue | 15 ------- .../docs/src/guide/creating-a-database.md | 42 +++++++++++++++++++ 4 files changed, 42 insertions(+), 33 deletions(-) delete mode 100755 packages/docs/src/.vuepress/components/Foo/Bar.vue delete mode 100755 packages/docs/src/.vuepress/components/OtherComponent.vue delete mode 100755 packages/docs/src/.vuepress/components/demo-component.vue diff --git a/packages/docs/src/.vuepress/components/Foo/Bar.vue b/packages/docs/src/.vuepress/components/Foo/Bar.vue deleted file mode 100755 index 7ee8286a2..000000000 --- a/packages/docs/src/.vuepress/components/Foo/Bar.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/packages/docs/src/.vuepress/components/OtherComponent.vue b/packages/docs/src/.vuepress/components/OtherComponent.vue deleted file mode 100755 index 1d97c7ca8..000000000 --- a/packages/docs/src/.vuepress/components/OtherComponent.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/packages/docs/src/.vuepress/components/demo-component.vue b/packages/docs/src/.vuepress/components/demo-component.vue deleted file mode 100755 index 7d49de79d..000000000 --- a/packages/docs/src/.vuepress/components/demo-component.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/packages/docs/src/guide/creating-a-database.md b/packages/docs/src/guide/creating-a-database.md index ab056f982..4c0c9bdd3 100644 --- a/packages/docs/src/guide/creating-a-database.md +++ b/packages/docs/src/guide/creating-a-database.md @@ -50,4 +50,46 @@ const movieDB = new Lyra({ }); ``` +# Input analyzer +By default, Lyra analyzes the input and performs a **stemming** operation, which allows the engine to perform more optimize queries, as well as saving indexing space. + +> In linguistic morphology and information retrieval, stemming is the process of reducing inflected (or sometimes derived) words to their word stem, base or root form—generally a written word form. The stem need not be identical to the morphological root of the word; it is usually sufficient that related words map to the same stem, even if this stem is not in itself a valid root. Algorithms for stemming have been studied in computer science since the 1960s. Many search engines treat words with the same stem as synonyms as a kind of query expansion, a process called conflation. ([Wikipedia](https://en.wikipedia.org/wiki/Stemming)) + +By default, Lyra uses the English language analyzer, but you can override this behaviour while initializing a new Lyra insrance: + +```js +import { lyra } from '@nearfom/lyra'; + +const movieDB = new Lyra({ + schema: { + title: 'string', + director: 'string', + plot: 'string', + year: 'number', + isFavorite: 'boolean' + }, + defaultLanguage: 'italian' +}); +``` + +You can override the default language for a given document during data insertion: + +```js +movieDB.insert(myDocument, 'spanish'); +``` + +As for today, the available languages are: + +- dutch +- english +- french +- italian +- norwegian +- portugese +- russian +- spanish +- swedish + +# Inserting data + Once the database is ready, you can start [adding some data to it](./insert-data.md). \ No newline at end of file