# @texthill/core

> A full text search engine using idf tf, that you can use in the browser and on the server

Latest version **0.3.0** (published 2020-10-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install @texthill/core
pnpm add @texthill/core
yarn add @texthill/core
bun add @texthill/core
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2020-10-24 |
| First published | 2020-10-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 67 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Joris Hermans |
| Maintainers | jorishermans |
| Keywords | search engine, full-text, nlp |

## Links

- npm: https://www.npmjs.com/package/@texthill/core
- Homepage: https://github.com/jorishermans/texthill
- Issues: https://github.com/jorishermans/texthill/issues
- npm.io page: https://npm.io/package/@texthill/core

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2020-10-24
- 0.2.0 — 2020-10-17

## README

## TextHill

A search engine written in typescript, can be used in the browser, with node.js and deno.

Look at this example below to get you started.
```typescript
const th = new TextHill(new MemoryStore());
const feed = async () => {
    await th.feedDoc("hello world", "some hello world for feeding");

    const results = await th.search("feeding"); 
}
```

Or remove the document from the index. 
```typescript
const th = new TextHill(new MemoryStore());
th.removeDoc("hello world").then(_ => console.log('succesfully removed'))
```

Write your own store to store your indexes where you prefer, extend from this abstract class.
```typescript
export abstract class Store {

    abstract getItem(key: string, defaultValue?: any): Promise<any>;

    abstract setItem(key: string, data: any): Promise<void>;

    abstract removeItem(key: string): Promise<void>;

}

/// implement your own store
export class MyStore extends Store {
    ...
}
const th = new TextHill(new MyStore());
```

You can also write your own stemmer or use snowball (look at node-snowball)
```typescript
export abstract class Stemmer {
  
    abstract stem(ch: string): string;

}

const th = new TextHill(new MyStore(), new Normalizer(new MyStemmer()));
```

---
_Source: https://npm.io/package/@texthill/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
