0.8.3 • Published 10 months ago

@blackglory/fts-js v0.8.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

fts-js

Install

npm install --save @blackglory/fts-js
# or
yarn add @blackglory/fts-js

API

enum QueryKeyword {
  And = 0
, Or = 1
, Not = 2
, Phrase = 3
, Prefix = 4
}

type IQueryExpression =
| ITermExpression
| IPhraseExpression
| IPrefixExpression
| IAndExpression
| IOrExpression
| INotExpression

type ITermExpression = string
type IPhraseExpression = [
  QueryKeyword.Phrase
, ...IQueryExpression[]
]
type IPrefixExpression = [
  QueryKeyword.Prefix
, string
]
type IAndExpression = [
  IQueryExpression
, QueryKeyword.And
, IQueryExpression
]
type IOrExpression = [
  IQueryExpression
, QueryKeyword.Or
, IQueryExpression
]
type INotExpression = [
  QueryKeyword.Not
, IQueryExpression
]

interface IFTSClientOptions {
  server: string
  timeout?: number
  retryIntervalForReconnection?: number
}

class FTSClient {
  static create(options: IFTSClientOptions): Promise<FTSClient>

  close(): Promise<void>

  getNamespaceStats(namespace: string, timeout?: number): Promise<INamespaceStats>
  getBucketStats(namespace: string, bucket: string, timeout?: number): Promise<IBucketStats>

  getAllNamespaces(timeout?: number): Promise<string[]>
  getAllBuckets(namespace: string, timeout?: number): Promise<string[]>

  clearBucketsByNamespace(namespace: string, timeout?: number): Promise<void>
  clearDocumentsByBucket(namespace: string, bucket: string, timeout?: number): Promise<void>

  setDocument(
    namespace: string
  , bucket: string
  , documentId: string
  , lexemes: string[]
  , timeout?: number
  ): Promise<void>

  removeDocument(
    namespace: string
  , bucket: string
  , documentId: string
  , timeout?: number
  ): Promise<void>

  queryDocuments(
    namespace: string
  , expression: IQueryExpression
  , options?: {
      buckets?: string[]
      limit?: number
      offset?: number
    }
  , timeout?: number
  ): Promise<IDocumentQueryResult[]>
}
0.8.3

10 months ago

0.8.1

1 year ago

0.8.2

1 year ago

0.8.0

1 year ago

0.7.0

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.3.0

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.2.7

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago