AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

결과에서 문서 점수 매기기

MongoDB Search 또는 MongoDB Vector Search 쿼리 에서 반환된 모든 문서 에는 관련성에 따라 점수가 할당되며, 결과 설정하다 에 포함된 문서는 가장 높은 점수부터 가장 낮은 점수 순으로 반환됩니다.

To include the score of each document in your search results, use the $project stage in your aggregation pipeline.

  • For the $search stage, the score field takes the $meta expression, which requires the searchScore value. You can also specify the searchScoreDetails value for the scoreDetails field $meta expression for a detailed breakdown of the score.

  • For the $vectorSearch stage, the score field takes the $meta expression, which requires the vectorSearchScore value to return the score of each document in your vector search results.

참고

다음 기능도 있습니다.

다른 쿼리에서 searchScorevectorSearchScore를 사용하는 경우, MongoDB는 v8.2부터 경고를 로그합니다.

예시

The following query uses a $project stage to add a field named score to the returned documents:

1db.movies.aggregate([
2 {
3 "$search": {
4 "text": {
5 <operator-specification>
6 }
7 }
8 },
9 {
10 "$project": {
11 "<field-to-include>": 1,
12 "<field-to-exclude>": 0,
13 "score": { "$meta": "searchScore" }
14 }
15 }
16])
1db.movies.aggregate([
2 {
3 "$search": {
4 "text": {
5 <operator-specification>
6 },
7 "scoreDetails": true
8 }
9 },
10 {
11 "$project": {
12 "<field-to-include>": 1,
13 "<field-to-exclude>": 0,
14 "scoreDetails": { "$meta": "searchScoreDetails" }
15 }
16 }
17])

자세한 내용은 점수 상세 정보 반환을 참조하세요.

1db.movies.aggregate([
2 {
3 "$vectorSearch": {
4 <query-syntax>
5 }
6 },
7 {
8 "$project": {
9 "<field-to-include>": 1,
10 "<field-to-exclude>": 0,
11 "score": { "$meta": "vectorSearchScore" }
12 }
13 }
14])

To learn more, see MongoDB Vector Search Scoring.

The score assigned to a returned document is part of the document's metadata. You can use a $project stage in your aggregation pipeline to include each returned document's score along with the result set. Documents return from highest score to lowest. Many factors can influence a document's score, including the following:

  • 문서에서 검색어의 위치입니다.

  • 문서에서 검색어의 발생 빈도입니다.

  • MongoDB Search 쿼리 사용하는 연산자 또는 분석기 의 유형입니다.

루센 점수 알고리즘 에 대해 자세히 학습하려면 루센 문서를 참조하세요.

기본값 채점 동작 외에도 MongoDB Search는 다음 옵션을 지원합니다.

  • 특정 문서에 할당된 점수를 수정합니다.

  • 점수 세부 정보 옵션을 사용하여 점수의 세부 분석을 반환합니다.

  • 검색 점수를 정규화합니다.

결과의 여러 문서에 동일한 점수가 있는 경우 결과의 문서 순서는 비결정적입니다. MongoDB Search 결과가 정해진 순서를 갖도록 하려면 단계에 $search 정렬 옵션을 포함하여 고유한 필드 기준으로 결과를 정렬합니다. 정렬 옵션을 사용하여 결과를 점수별로 오름차순으로 정렬하여 반환할 수도 있습니다. 자세히 학습 MongoDB 검색 결과 정렬점수별 정렬 예시를 참조하세요.

On separate Search Nodes, each node assigns documents different internal Lucene IDs used for sorting when scores are identical. When sorting and paginating results, the mongot process on the node that is processing the query might include documents from other nodes if their internal IDs have greater pagination order than the token. To prevent this, use $match after $search to exclude documents by their _id.

배열 값을 쿼리할 때 MongoDB Search는 배열 에서 쿼리 와 일치하는 값이 더 많을수록 더 높은 점수를 할당합니다.

MongoDB Search 쿼리에서 추가 score 옵션을 사용하는 방법에 대한 예는 다음 페이지를 참조하세요.

몇 가지 일반적인 MongoDB Search 쿼리에서 score 필드 사용하는 방법에 대한 예는 다음 페이지를 참조하세요.

이 페이지 평가하기