1.0.25 • Published 2 months ago

@codelic/searchforfirestorebyngram v1.0.25

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

searchForFirestoreByNGram

firestore内で全文検索を実装するためのモジュール 

使用時の注意

  • ネストしているフィールドのテキストを検索対象としては取ってこれない
  • 現時点のバージョンではOR検索ができない
  • スペースを挟んだキーワードを検索する場合はAND検索となる

使用方法

cloud functionsの追加設定

const firestore = getFirestore(app);

import {
  functionFactoryForWriteHook,
  functionFactoryForSearchRequest,
} from "@codelic/searchforfirestorebyngram";
// onWriteでデータの追加されたタイミングで検索用のDBへ検索用のドキュメントを追加
export const createBinaryGrumDoc = functionFactoryForWriteHook(
  firestore,
  "users"
);
// 検索リクエストを投げる先のAPI
export const getSearchRequest = functionFactoryForSearchRequest(firestore);

検索をかけたい場合のリクエストの中身のタイプ情報

type query ={
    collectionName: string; // 対象のコレクション名 例)User
    targetFieldName: string; // 検索をかけたいフィールド名 例)name
    searchWord: string; // 検索キーワード 例)山田
}

制限に関して

  • firestoreドキュメントの最大情報量が1MBなので検索用のドキュメントが1MB超えるようであれば検索自体難しい
1.0.25

2 months ago

1.0.24

2 months ago

1.0.23

2 months ago

1.0.19

2 months ago

1.0.18

2 months ago

1.0.17

2 months ago

1.0.21

2 months ago

1.0.20

2 months ago

1.0.16

2 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago