AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

カスタムアナライザ

MongoDB検索するアナライザは、文字のシーケンスを変換、フィルター、グループ化するための一連の操作を実行して、インデックスを作成するドキュメントのセットを準備します。Atlas UIから、特定のインデックスの作成ニーズに合わせてカスタムアナライザを定義できます。

A custom MongoDB Search analyzer is made up of a tokenizer, an optional list of character filters, and an optional list of token filters. When MongoDB Search analyzes text with a custom analyzer, the text passes through the character filters first, then the tokenizer, and then the token filters.

カスタムアナライザの構文は次のとおりです。

構文
"analyzers": [
{
"name": "<name>",
"charFilters": [ <list-of-character-filters> ],
"tokenizer": {
"type": "<tokenizer-type>"
},
"tokenFilters": [ <list-of-token-filters> ]
}
]

カスタムアナライザには、次の属性があります。

属性
タイプ
説明
必須

name

string

カスタムアナライザの名前。 名前はインデックス内で一意である必要があり、次のいずれかの文字列で始まらない必要があります。

  • lucene.

  • builtin.

  • mongodb.

はい

charFilters

オブジェクトのリスト

0個以上の文字フィルターを含む配列。

文字フィルターは、テキストを 1 文字ずつ調べてフィルタリング処理を行います。

詳細については、「文字フィルター」を参照してください。

no

tokenizer

オブジェクト

トークンを作成するために使用するトークナイザ。

アナライザは、インデックスを作成する目的で、トークナイザを使用してテキストのかたまりをグループまたはトークンに分裂します。

詳細については、「トークナイザ」を参照してください。

はい

tokenFilters

オブジェクトのリスト

0 個以上のトークン フィルターを含む配列。

トークン フィルターは、以下のような処理を実行します。

  • ステミング 。これにより、「toring」、「thaled」、「torages」などの関連単語を語幹単語の「torage」に減らします。

  • リダクションは、公開ドキュメントから機密情報を排除します。

To learn more, see Token Filters for Custom Analyzers.

no

The Atlas UI Visual Editor includes the option to choose between the following common-use templates to help you get started with building your custom analyzer:

  • メール パーサー - uaxUrlEmail トークナイザで最大 200 文字のメールアドレスをトークン化するために使用します。たとえば、このアナライザは、サンプル コレクションpage_updated_by.email フィールドに適用できます。

  • 電話番号 - regexCaptureGroup トークナイザで米国形式の電話番号から単一トークンを作成するために使用します。たとえば、サンプル コレクションpage_updated_by.phone フィールドにこのアナライザを適用できます。

  • ハイフン区切りの ID - regexSplitトークナイザを使用して、ハイフンで区切られたテキストからトークンを作成する際に使用します。たとえば、コレクション例message フィールドにこのアナライザを適用できます。

これらの組み込みカスタムアナライザを使用するか、MongoDB Search Visual Editor または JSON エディターを使用して独自のカスタムアナライザを作成できます。

The Character Filters, Tokenizers, and Token Filters for Custom Analyzers pages contain sample index definitions and query examples for character filters, tokenizers, and token filters. These examples use a sample minutes collection with the following documents:

{
"_id": 1,
"page_updated_by": {
"last_name": "AUERBACH",
"first_name": "Siân",
"email": "auerbach@example.com",
"phone": "(123)-456-7890"
},
"title": "The team's weekly meeting",
"message": "try to siGn-In",
"text": {
"en_US": "<head> This page deals with department meetings.</head>",
"sv_FI": "Den här sidan behandlar avdelningsmöten",
"fr_CA": "Cette page traite des réunions de département"
}
}
{
"_id": 2,
"page_updated_by": {
"last_name": "OHRBACH",
"first_name": "Noël",
"email": "ohrbach@example.com",
"phone": "(123) 456 0987"
},
"title": "The check-in with sales team",
"message": "do not forget to SIGN-IN. See ① for details.",
"text" : {
"en_US": "The head of the sales department spoke first.",
"fa_IR": "ابتدا رئیس بخش فروش صحبت کرد",
"sv_FI": "Först talade chefen för försäljningsavdelningen"
}
}
{
"_id": 3,
"page_updated_by": {
"last_name": "LEWINSKY",
"first_name": "Brièle",
"email": "lewinsky@example.com",
"phone": "(123).456.9870"
},
"title": "The regular board meeting",
"message": "try to sign-in",
"text" : {
"en_US": "<body>We'll head out to the conference room by noon.</body>"
}
}
{
"_id": 4,
"page_updated_by": {
"last_name": "LEVINSKI",
"first_name": "François",
"email": "levinski@example.com",
"phone": "123-456-8907"
},
"title": "The daily huddle on tHe StandUpApp2",
"message": "write down your signature or phone №",
"text" : {
"en_US": "<body>This page has been updated with the items on the agenda.</body>" ,
"es_MX": "La página ha sido actualizada con los puntos de la agenda.",
"pl_PL": "Strona została zaktualizowana o punkty porządku obrad."
}
}

独自のカスタムアナライザの作成についての詳細は、以下の参照ページをご覧ください。

注意

Atlas UI でVisual Editorを使用してカスタムアナライザを追加すると、Atlas UI のCustom Analyzersセクションにアナライザに関する次の詳細が表示されます。

名前

カスタムアナライザを識別するラベル。

で使用される

カスタムアナライザを使用するフィールド。 カスタム アナライザ がフィールドを分析するために使用されない場合、値は[なし]です。

文字フィルター

カスタムアナライザで構成されたMongoDB Search 文字フィルター。

トークナイザ

カスタムアナライザで構成されたMongoDB Searchトークナイザ。

トークン フィルター

カスタムアナライザで構成されたMongoDB Search トークン フィルター。

アクション

カスタム アナライザで実行できるアクションを示すクリック可能なアイコン。

  • をクリックしますカスタムアナライザを編集します。

  • をクリックしますカスタムアナライザを削除します。