@texthill/core
    TypeScript icon, indicating that this package has built-in type declarations

    0.3.0 • Public • Published

    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.

    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.

    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.

    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)

    export abstract class Stemmer {
      
        abstract stem(ch: string): string;
     
    }
     
    const th = new TextHill(new MyStore(), new Normalizer(new MyStemmer()));

    Install

    npm i @texthill/core

    DownloadsWeekly Downloads

    3

    Version

    0.3.0

    License

    ISC

    Unpacked Size

    68.6 kB

    Total Files

    54

    Last publish

    Collaborators

    • jorishermans