simple 분석기는 공백, 구두점 또는 하나 이상의 숫자와 같은 문자가 아닌 문자를 찾을 때마다 텍스트를 검색 가능한 용어(토큰)로 나눕니다. 모든 텍스트를 소문자로 변환합니다.
Refine Your Index를 선택하면 Atlas UI Index Configurations 섹션 내에 View text analysis of your selected index configuration 이라는 제목의 섹션이 표시됩니다. 이 섹션을 확장하면 Atlas UI simple 분석기 각 샘플 문자열에 대해 생성하는 인덱스 및 검색 토큰이 표시됩니다. Atlas UI Visual Editor에서 인덱스 생성하거나 편집할 때 simple 분석기 내장 샘플 문서 및 쿼리 문자열에 대해 생성하는 토큰을 볼 수 있습니다.
중요
MongoDB Search는 분석기 토큰 크기가 32766 바이트를 초과하는 문자열 필드를 인덱스 하지 않습니다. 키워드 분석기 사용하는 경우 32766 바이트를 초과하는 문자열 필드는 인덱싱되지 않습니다.
예시
The following example index definition specifies an index on the title field in the sample_mflix.movies collection using the simple analyzer. To follow along with this example, load the sample data on your cluster and either use mongosh or navigate to the Create a Search
Index page in the Atlas UI following the steps in the Create a MongoDB Search Index tutorial.
Then, using the movies collection as your data source, follow the example procedure to create an index from mongosh or the Atlas UI Visual Editor or JSON editor.
다음 쿼리는 title 필드에서 lion 라는 용어를 검색하여 출력을 5개의 결과로 제한합니다.
MongoDB Search는 lucene.simple 분석기 사용하여 title 필드 의 텍스트에 대해 다음을 수행하여 이러한 문서를 반환합니다.
텍스트를 소문자로 변환합니다.
문자가 아닌 문자가 있는 곳마다 텍스트를 나누어 별도의 토큰을 만듭니다.
The following table shows the tokens that MongoDB Search creates for each document in the results using the Simple Analyzer. For comparison, the table also shows tokens from the Standard Analyzer and Whitespace Analyzer:
제목 | 간단한 분석기 토큰 | 표준 분석기 토큰 | 공백 분석기 토큰 |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MongoDB Search는 simple 분석기가 쿼리 텀 lion과 일치하는 lion의 텀을 별도로 생성했으므로 결과에 문서 Lion's Den 을 반환합니다. 반면 Standard Analyzer 또는 Whitespace Analyzer를 사용하여 필드에 인덱스를 생성하면 MongoDB Search는 Lion's Den을 반환하지 않습니다. Standard 분석기 는 토큰 lion's 을 생성하고 Whitespace 분석기 는 Lion's를 생성하지만 두 분석기 모두 lion의 토큰을 생성하지 않습니다.