Rest api 카테고리로 검색시 totalCount안에 들어오는 기준이 궁금합니다

안녕하세요~
현재 restAPI를 이용해 카테고리 검색을 이용해봤는데 리스폰스 meta 데이터에있는 totalCount에 잡히는 주소들이 어떤 기준으로 잡히는건지 궁금합니다.

const getPoliLine = (
x: number,
y: number,
targetCenterX: number,
targetCenterY: number
) => {
const polyline = new kakao.maps.Polyline({
path: [
[
new kakao.maps.LatLng(x, y),

      new kakao.maps.LatLng(targetCenterX, targetCenterY)
    ]
  ]
})

const length = structuredClone(polyline.getLength())
polyline.setMap(null)
return Math.round(length)

}

현재 이런식으로 polyline의 getLength를 이용하여 가져온 데이터의 x,y를 이용해 제가 설정한 중심점과 radius를 이용하여

data.forEach((d) => {
const existingIndex = tempSearchResults.findIndex(
(r) => r.id === d.id
)

      const length = getPoliLine(
        parseFloat(d.x),
        parseFloat(d.y),
        centerLocation.getLng(),
        centerLocation.getLat()
      )

      if (existingIndex === -1 && length <= searchCondition.targetRadius) {
        if (targetCategory) {
          tempSearchResults.push({ ...d, category: targetCategory?.label })
        }
      }
    })

이런식으로 ps.categorySearch 콜백안에서 비교하고 있는데 데이터가 잘 맞지않네요.
중심점으로 부터 해당 주소의 거리를 계산하는 방법이 있을까요?? distance를 이용하는 법 말고요.

설명이 부실해서 죄송합니다.

안녕하세요~

우선 totalcount란 값은, 검색된 문서(documents에 들어있는 각각의 결과들)의 총 갯수라고 보시면 됩니다. 다만 이 값은 중복된 문서나, 불필요한 세부정보가 들어있어 구분할 필요가 없는 정보등이 모두 포함된 값입니다.
즉 기본적으로 totalCount값은 이용할 일은 거의 없습니다.

실제 페이징처리나 보여질 데이터의 총 갯수는
pageable_count 값을 보셔야 합니다.

두번째 질문은, 좀더 구체적으로 적어주시면 좋을 것 같습니다.
두점간의 직선거리를 구하는 것이라면 지금처럼 start,end만 같은 polyline으로 구할 수 있습니다.
직선거리가 아닌, 실제 지도위의 도로라인을 따라 거리를 구하셔야 될까요?
그리고 데이터가 잘 맞지 않는다는 것도, 어떤 데이터가 어떻게 다른지 말씀해 주시면 감사하겠습니다.