공개 이슈 gnuboard/g7 이 지목한 병목은 "같은 일을 반복 실행한다" 축이다. 응답·행의 무게를 다룬 · 과 겹치지 않는다. 공통 계약 — 총 건수 상한과 페이지 이동 범위는 별개 결정이다. 묶으면 필요 없이 기능이 깎인다. 총 건수만 상한을 받고(파생 테이블 COUNT), "다음" 이동은 per_page + 1 실측으로 끝까지 열어 둔다. 계산이 불가능해지는 것은 마지막 페이지 번호 하나뿐이며 그 사실은 last_page: null 이 알린다. 최신순처럼 실제 컬럼으로 정렬하는 목록은 커서로 전환해 깊이와 무관하게 일정 속도로 이동한다. 관련도순은 계산값 정렬이라 커서 키로 쓸 수 없어 offset 을 유지한다. 계약의 입구는 표준 paginate 와 같은 폭이어야 한다. 관계·쿼리 빌더를 받지 못하면 그 좁은 만큼이 그대로 운영 500 이 되고, 실제로 관리자 알림 목록에서 그렇게 터졌다. 응답 조립도 컬렉션마다 손으로 하면 형태가 늘어나는 순간 없는 값을 부르거나 새 필드를 흘리므로, 형태 판정을 paginationMeta 한 곳에 모았다. 표준 paginate 응답은 필드 단위로 이전과 동일하다. 요청당 반복 비용 — 훅 구독마다 남기던 로그 400줄, 요청당 스무 번 넘던 설정 파일 재읽기, 이미 캐시된 목록의 DB 재조회를 없앴다. 권한 판정은 요청 스코프 메모를 두어 화면 요소마다 나가던 조회를 한 번으로 줄였고, 크로스 요청 캐시는 두지 않아 권한 변경이 종전처럼 다음 요청에 반영된다. 검색 질의는 활성 엔진이 만든다. 저장소가 구체 엔진을 지목하면 플러그인이 등록한 엔진은 호출될 기회 자체를 잃고 오류 없이 다른 방식으로 동작한다. 해석기를 두어 활성 엔진에 위임하고, 전문검색이 없는 DBMS 의 부분일치 폴백도 드라이버명 하드코딩 대신 선언형 config 로 옮겼다. 총 건수가 잘린 목록에서 순번을 역산하면 0 과 음수가 나온다. 지어내지 않고 null 을 돌려주며, 그 원칙을 last_page 와 동일하게 적용했다.
78 lines
3.9 KiB
PHP
78 lines
3.9 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Search related messages (English)
|
|
*/
|
|
|
|
return [
|
|
'empty_keyword' => 'Please enter a search keyword.',
|
|
'results_found' => ':count results found.',
|
|
'results_found_at_least' => 'More than :count results found.',
|
|
'result_cap_notice' => 'More than :cap items matched, so the exact total was not counted. You can still move to the next page.',
|
|
'refine_query_hint' => 'Narrow your search terms to see the exact total and jump to the last page.',
|
|
'no_results' => 'No results found.',
|
|
'view_more' => 'View more',
|
|
|
|
// Validation messages
|
|
'validation' => [
|
|
'q_min' => 'Please enter at least 2 characters for search.',
|
|
'q_max' => 'Search keyword must not exceed 200 characters.',
|
|
'page_integer' => 'Page number must be a number.',
|
|
'page_min' => 'Page number must be at least 1.',
|
|
'page_max' => 'Page number must not exceed :max. Please narrow your search terms.',
|
|
'per_page_integer' => 'Items per page must be a number.',
|
|
'per_page_min' => 'Items per page must be at least 1.',
|
|
'per_page_max' => 'Items per page must not exceed 100.',
|
|
],
|
|
|
|
// Search index inspection / rebuild (search:index) — engine neutral
|
|
'index' => [
|
|
'status' => [
|
|
'healthy' => 'Healthy',
|
|
'degraded' => 'Partial',
|
|
'stale' => 'Not indexed',
|
|
'skipped' => 'Not determinable',
|
|
],
|
|
|
|
'no_maintainer' => 'The current search engine (:driver) does not provide index inspection. It will appear here once its provider registers one.',
|
|
'unavailable' => 'The index of the current search engine (:driver) cannot be inspected.',
|
|
'no_targets' => 'The search engine (:driver) has no index to inspect.',
|
|
'driver_label' => 'Search engine: :driver',
|
|
|
|
'col' => [
|
|
'index' => 'Index',
|
|
'status' => 'Status',
|
|
'measurement' => 'Measurement',
|
|
],
|
|
|
|
'counts' => 'Healthy :healthy · Partial :degraded · Not indexed :stale · Not determinable :skipped (total :total)',
|
|
'rebuild_targets' => ':count index(es) to rebuild',
|
|
'rebuild_cost_warning' => 'Rebuilding locks or re-indexes the target. On a live site, run it during a maintenance window.',
|
|
'rebuild_confirm' => 'Rebuild the indexes listed above?',
|
|
'rebuild_after_bulk_confirm' => 'Rebuild search indexes after the bulk update? (default: no — on a live site, run it during a maintenance window)',
|
|
'rebuild_skipped' => 'Skipping the rebuild.',
|
|
'stale_hint' => 'Some indexes hold no indexed content. Rebuild them with `php artisan search:index --repair`.',
|
|
'stale_after_update' => ':count search index(es) hold no indexed content, so those searches return nothing.',
|
|
'rebuilt_item' => 'Rebuilt: :index',
|
|
'rebuild_failed_item' => 'Rebuild failed: :index — :error',
|
|
'still_stale_item' => 'Still not indexed after rebuild: :index',
|
|
'degraded_hint' => '"Partial" may come from the engine tokenizer, so it is not rebuilt automatically. Inspect individually if needed.',
|
|
|
|
'report' => [
|
|
'nothing_to_do' => 'Inspected :count · nothing to rebuild',
|
|
'rebuilt' => 'Inspected :inspected · rebuilt :repaired · failed :failed · still stale :remaining',
|
|
],
|
|
|
|
// mysql-fulltext driver specific
|
|
'fulltext' => [
|
|
'unsupported_driver' => 'The current database driver does not support FULLTEXT (search falls back to LIKE; nothing to inspect).',
|
|
'self_match' => ':found/:probed rows found themselves',
|
|
'skip' => [
|
|
'no_single_pk' => 'No single-column primary key, so per-row inspection is not possible',
|
|
'no_rows' => 'No row has content in the indexed columns',
|
|
'no_tokens' => 'Could not build a search token from the sampled rows (content too short)',
|
|
],
|
|
],
|
|
],
|
|
];
|