Skip to content

Commit

Permalink
docs(docs): adds explaination about input analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
micheleriva committed Jun 11, 2022
1 parent c12aec4 commit 748a745
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 33 deletions.
15 changes: 0 additions & 15 deletions packages/docs/src/.vuepress/components/Foo/Bar.vue

This file was deleted.

3 changes: 0 additions & 3 deletions packages/docs/src/.vuepress/components/OtherComponent.vue

This file was deleted.

15 changes: 0 additions & 15 deletions packages/docs/src/.vuepress/components/demo-component.vue

This file was deleted.

42 changes: 42 additions & 0 deletions packages/docs/src/guide/creating-a-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

0 comments on commit 748a745

Please sign in to comment.