Docs Menu
Docs Home
/
Atlas
/ / / /

표준 분석기

standard 분석기 모든 MongoDB Search 인덱스 및 쿼리에 대한 기본값 입니다. 텍스트를 단어 경계에 따라 용어로 나누므로 대부분의 사용 사례에서 언어 중립적입니다. 모든 용어를 소문자로 변환하고 구두점을 제거합니다. 이메일 주소, 약어, 중국어-일본어-한국어 문자, 영숫자 등을 인식하는 문법 기반 토큰화를 제공합니다.

Refine Your Index을 선택하면 Atlas UI Index Configurations 섹션 내에 View text analysis of your selected index configuration 라는 제목의 섹션이 표시됩니다. 이 섹션을 확장하면 Atlas UI standard 분석기 각 샘플 문자열에 대해 생성하는 인덱스 및 검색 토큰이 표시됩니다. Atlas UI Visual Editor에서 인덱스 생성하거나 편집할 때 standard 분석기 내장 샘플 문서 및 쿼리 문자열에 대해 생성하는 토큰을 볼 수 있습니다.

중요

MongoDB Search는 분석기 토큰 크기가 32766 바이트를 초과하는 문자열 필드를 인덱스 하지 않습니다. 키워드 분석기 사용하는 경우 32766 바이트를 초과하는 문자열 필드는 인덱싱되지 않습니다.

다음 예시 인덱스 정의는 분석기 title 사용하여sample_mflix.movies 컬렉션 의 필드 에 대한 standard 인덱스 지정합니다. 이 예시 따라 진행하려면 클러스터에 샘플 데이터를 mongosh 로드하고 Create a Search Index 를 사용하거나 MongoDB 검색 인덱스 만들기 튜토리얼의 단계에 따라 Atlas UI 의 페이지로 이동합니다.

그런 다음 movies 컬렉션 데이터 소스로 사용하여 예시 절차에 따라 mongosh 또는 Atlas UI Visual Editor 또는 JSON editor에서 인덱스 생성합니다.


언어 선택 드롭다운 메뉴를 사용하여 이 페이지의 예시에 대한 인터페이스를 설정하다.


  1. 인덱스를 구성하려면 Refine Your Index을(를) 클릭합니다.

  2. Index Configurations 섹션에서 Dynamic Mappingoff로 전환합니다.

  3. Field Mappings 섹션에서 Add Field Mapping 을 클릭하여 Add Field Mapping창을 엽니다.

  4. Customized Configuration를 클릭합니다.

  5. Field Name 드롭다운 메뉴에서 title을(를) 선택합니다.

  6. Data Type 드롭다운을 클릭하고 아직 선택되지 않은 경우 String을(를) 선택합니다.

  7. String Properties을 확장하고 다음과 같이 변경합니다:

    인덱스 분석기

    아직 선택되지 않은 경우 드롭다운에서 lucene.standard을(를) 선택합니다.

    검색 분석기

    아직 선택되지 않은 경우 드롭다운에서 lucene.standard을(를) 선택합니다.

    인덱스 옵션

    기본값 offsets을(를) 사용합니다.

    Store

    기본값 true을(를) 사용합니다.

    위 내용 무시

    기본 설정을 유지합니다.

    규범

    기본값 include을(를) 사용합니다.

  8. Add를 클릭합니다.

  9. Save Changes를 클릭합니다.

  10. Create Search Index를 클릭합니다.

  1. 기본 인덱스 정의를 다음 인덱스 정의로 바꾸세요.

    {
    "mappings": {
    "fields": {
    "title": {
    "type": "string",
    "analyzer": "lucene.standard"
    }
    }
    }
    }
  2. Next를 클릭합니다.

  3. Create Search Index를 클릭합니다.

1db.movies.createSearchIndex(
2 "default",
3 {
4 "mappings": {
5 "fields": {
6 "title": {
7 "type": "string",
8 "analyzer": "lucene.standard"
9 }
10 }
11 }
12 }
13)

다음 쿼리는 title 필드에서 action 용어를 검색하고 출력을 두 개의 결과로 제한합니다.

  1. 인덱스 의 Query 버튼을 클릭합니다.

  2. 쿼리 편집하려면 Edit Query 을(를) 클릭합니다.

  3. 쿼리 줄에서 을 클릭하고 데이터베이스 와 컬렉션 선택합니다.

  4. 기본값 쿼리 다음으로 바꾸고 Find을 클릭합니다.

    [
    {
    "$search": {
    "text": {
    "query": "action",
    "path": "title"
    }
    }
    }
    ]
    SCORE: 4.001246452331543 _id: "573a1398f29313caabceac7f"
    awards: Object
    cast: Array (4)
    countries: Array (1)
    directors: Array (1)
    fullplot: "Jericho "Action" Jackson is a Detroit police sergeant who was demoted …"
    genres: Array (3)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-08-20 00:24:08.470000000"
    num_mflix_comments: 2
    plot: "Vengence drives a tough Detroit cop to stay on the trail of a power hu…"
    poster: "https://m.media-amazon.com/images/M/MV5BZWFhNmI3OWQtOTU5Zi00ODA3LWExNj…"
    rated: "R"
    released: 1988-02-12T00:00:00.000+00:00
    runtime: 96
    title: "Action Jackson"
    tomatoes: Object
    type: "movie"
    writers: Array (1)
    year: 1988
    SCORE: 4.001246452331543 _id: "573a1399f29313caabcec6b7"
    awards: Object
    cast: Array (4)
    countries: Array (1)
    directors: Array (1)
    fullplot: "Jeb Ward is an attorney who specializes in whistle blower, David vs. Goliath cases. When a major auto manufacturer is accused of knowingly marketing a defective car, Ward takes on the case, risking everything."
    genres: Array (2)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-09-06 00:42:51.167000000"
    metacritic: 58
    num_mflix_comments: 2
    plot: "Jeb Ward is an attorney who specializes in whistle blower, David vs. Goliath cases."
    poster: "https://m.media-amazon.com/images/M/MV5BNWY5Mjk4ZmItMTAzYS00NWE3LWEzYz…"
    rated: "R"
    released: 1991-03-15T00:00:00.000+00:00
    runtime: 110
    title: "Class Action"
    tomatoes: Object
    type: "movie"
    writers: Array (3)
    year: 1991
    SCORE: 4.001246452331543 _id: "573a13b0f29313caabd333e7"
    awards: Object
    cast: Array (4)
    countries: Array (2)
    directors: Array (1)
    fullplot: "Vishi is a local goon who basically likes beating up people to get his way. He falls in love with Khushi, but his life takes a turn when he crosses paths with a ruthless mafia kingpin."
    genres: Array (3)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-09-10 17:20:55.697000000"
    num_mflix_comments: 1
    plot: "In order to escape crime and clutches of a ruthless mafia, a Bangkok based goon seeks help from his lookalike, a Mumbai based criminal."
    released: 2014-12-05T00:00:00.000+00:00
    runtime: 144
    title: "Action Jackson"
    tomatoes: Object
    type: "movie"
    writers: Array (3)
    year: 2014
    SCORE: 4.001246452331543 _id: "573a13d2f29313caabd913dc"
    awards: Object
    countries: Array (1)
    directors: Array (1)
    genres: Array (2)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-06-15 03:15:33.967000000"
    num_mflix_comments: 0
    released: 2011-01-28T00:00:00.000+00:00
    runtime: 45
    title: "Slow Action"
    tomatoes: Object
    type: "movie"
    writers: Array (1)
    year: 2011
    SCORE: 3.440462112426758 _id: "573a1399f29313caabcedcb0"
    awards: Object
    cast: Array (4)
    countries: Array (1)
    directors: Array (1)
    fullplot: "Young Danny Madigan is a big fan of Jack Slater, a larger-than-life action hero. When Danny is given a magic ticket, he is transported into Slater's latest adventure."
    genres: Array (3)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-08-31 00:11:25.920000000"
    metacritic: 44
    num_mflix_comments: 0
    plot: "With the help of a magic ticket, a young film fan is transported into the fictional world of his favorite action movie character."
    poster: "https://m.media-amazon.com/images/M/MV5BNjdhOGY1OTktYWJkZC00OGY5LWJhY2…"
    rated: "PG-13"
    released: 1993-06-18T00:00:00.000+00:00
    runtime: 130
    title: "Last Action Hero"
    tomatoes: Object
    type: "movie"
    writers: Array (4)
    year: 1993
    SCORE: 3.440462112426758 _id: "573a139af29313caabcf0e84"
    awards: Object
    cast: Array (4)
    countries: Array (1)
    directors: Array (1)
    fullplot: "Jan Schlichtmann, a tenacious lawyer, is addressed by a group of families whose children have died from leukemia. He takes on a case against two large companies accused of dumping toxic waste."
    genres: Array (1)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-09-07 00:21:34.950000000"
    metacritic: 68
    num_mflix_comments: 0
    plot: "The families of children who died sue two companies for dumping toxic waste."
    poster: "https://m.media-amazon.com/images/M/MV5BZmEzNjhiZWEtNTM5OS00ZmQyLThhYj…"
    rated: "PG-13"
    released: 1999-01-08T00:00:00.000+00:00
    runtime: 115
    title: "A Civil Action"
    tomatoes: Object
    type: "movie"
    writers: Array (2)
    year: 1998
    SCORE: 2.687220573425293 _id: "573a1398f29313caabcead32"
    awards: Object
    cast: Array (4)
    countries: Array (1)
    directors: Array (1)
    fullplot: "Colonel James Braddock has a Vietnamese wife who was supposed to leave Vietnam with him, but was left behind. Years later, he returns to rescue her and their son."
    genres: Array (2)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-08-17 00:28:26.627000000"
    num_mflix_comments: 0
    plot: "Colonel James Braddock has a Vietnamese wife who was supposed to leave Vietnam with him, but was left behind."
    poster: "https://m.media-amazon.com/images/M/MV5BZTRjODU0MTUtMjBmMi00ZTBmLTk2MD…"
    rated: "R"
    released: 1988-03-02T00:00:00.000+00:00
    runtime: 101
    title: "Braddock: Missing in Action III"
    tomatoes: Object
    type: "movie"
    writers: Array (5)
    year: 1988
    SCORE: 2.687220573425293 _id: "573a13a9f29313caabd1f502"
    awards: Object
    cast: Array (4)
    countries: Array (2)
    directors: Array (1)
    fullplot: "Bugs Bunny and Daffy Duck are up to their feuding ways again. Tired of all the attention going to Bugs, Daffy persuades the studio to let him go off on his own."
    genres: Array (3)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-08-28 00:30:31.080000000"
    metacritic: 64
    num_mflix_comments: 1
    plot: "The Looney Tunes search for a man's missing father and the mythical Blue Monkey diamond."
    poster: "https://m.media-amazon.com/images/M/MV5BMTkxNDk5MDQ2MF5BMl5BanBnXkFtZT…"
    rated: "PG"
    released: 2003-11-14T00:00:00.000+00:00
    runtime: 91
    title: "Looney Tunes: Back in Action"
    tomatoes: Object
    type: "movie"
    writers: Array (1)
    year: 2003
    SCORE: 2.4220800399780273 _id: "573a13bdf29313caabd5acfe"
    awards: Object
    cast: Array (4)
    countries: Array (1)
    directors: Array (1)
    fullplot: "Fueled by the belief that another world is possible, acclaimed filmmaker Velcrow Ripper takes us on a journey through the spiritual activism movement."
    genres: Array (1)
    imdb: Object
    languages: Array (1)
    lastupdated: "2015-08-12 00:50:56"
    num_mflix_comments: 1
    plot: "Captures the exciting movement of Spiritual Activism that is exploding around the planet."
    poster: "https://m.media-amazon.com/images/M/MV5BMTI2MjM2Mzk2NV5BMl5BanBnXkFtZT…"
    released: 2008-10-01T00:00:00.000+00:00
    runtime: 90
    title: "Fierce Light: When Spirit Meets Action"
    tomatoes: Object
    type: "movie"
    writers: Array (1)
    year: 2008
db.movies.aggregate([
{
"$search": {
"text": {
"query": "action",
"path": "title"
}
}
},
{
"$limit": 2
},
{
"$project": {
"_id": 0,
"title": 1
}
}
])
[
{
title: 'Action Jackson'
},
{
title: 'Class Action'
}
]

MongoDB Search는 {MongoDB} action action title lucene.standard 분석기 사용하여 필드 의 텍스트에 대해 다음을 수행하여 생성한 문서의 토큰 에 쿼리 텀 을 일치시켰기 때문에 이러한 문서를 반환했습니다.

  • 텍스트를 소문자로 변환합니다.

  • 단어 경계를 기준으로 텍스트를 분할하고 별도의 토큰을 만듭니다.

다음 표는 MongoDB Search 표준 분석기 를 사용하여 생성하는 토큰(검색 가능한 용어)과 대조적으로 결과의 문서에 대해 키워드 분석기공백 분석기 에 대해 생성하는 토큰을 보여줍니다.

제목
표준 분석기 토큰
키워드 분석기 토큰
공백 분석기 토큰

Action Jackson

action, jackson

Action Jackson

Action, Jackson

Class Action

class, action

Class Action

Class, Action

인덱싱할 때

  • MongoDB 분석기를 사용하는 경우, 분석기 쿼리텀 필드 actionkeyword 전체 텀 검색 일치하는 문서(Action JacksonClass Action)를 반환합니다.

  • 공백 분석기를 사용할 경우 MongoDB Search는 whitespace 분석기 title 필드 값을 원래의 대소문자(Action)로 토큰화하고 쿼리 텀 소문자가 소문자이므로 MongoDB Search는 쿼리 텀 action 에 대한 결과의 문서와 일치하지 않습니다. whitespace 분석기 토큰과 일치하지 않는 action입니다.

돌아가기

분석기

이 페이지의 내용