@foundrykit/search-plugin 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +151 -0
- package/dist/analytics.d.ts +36 -0
- package/dist/analytics.js +71 -0
- package/dist/analytics.js.map +1 -0
- package/dist/cache.d.ts +21 -0
- package/dist/cache.js +42 -0
- package/dist/cache.js.map +1 -0
- package/dist/collections/SearchEvents.d.ts +15 -0
- package/dist/collections/SearchEvents.js +62 -0
- package/dist/collections/SearchEvents.js.map +1 -0
- package/dist/components/SearchDashboard.d.ts +13 -0
- package/dist/components/SearchDashboard.js +170 -0
- package/dist/components/SearchDashboard.js.map +1 -0
- package/dist/components/useSearchHotkey.d.ts +15 -0
- package/dist/components/useSearchHotkey.js +71 -0
- package/dist/components/useSearchHotkey.js.map +1 -0
- package/dist/decodeEntities.d.ts +12 -0
- package/dist/decodeEntities.js +13 -0
- package/dist/decodeEntities.js.map +1 -0
- package/dist/endpoints/handlers.d.ts +24 -0
- package/dist/endpoints/handlers.js +95 -0
- package/dist/endpoints/handlers.js.map +1 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.js +3 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +3 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +11 -0
- package/dist/options.js +42 -0
- package/dist/options.js.map +1 -0
- package/dist/project.d.ts +37 -0
- package/dist/project.js +82 -0
- package/dist/project.js.map +1 -0
- package/dist/rank.d.ts +38 -0
- package/dist/rank.js +110 -0
- package/dist/rank.js.map +1 -0
- package/dist/resolve.d.ts +25 -0
- package/dist/resolve.js +86 -0
- package/dist/resolve.js.map +1 -0
- package/dist/types.d.ts +125 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +96 -0
package/dist/rank.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FuzzyOptions, GroupedResults, IndexedDoc, SearchField, SearchGroup } from './types.js';
|
|
2
|
+
export declare const DEFAULT_FIELDS: SearchField[];
|
|
3
|
+
export declare const DEFAULT_FUZZY: Required<FuzzyOptions>;
|
|
4
|
+
/**
|
|
5
|
+
* Rank documents against a query.
|
|
6
|
+
*
|
|
7
|
+
* Fuse gives fuzzy tolerance for typos, plurals and word order. Its score is then divided by the
|
|
8
|
+
* collection weight so a configured priority can lift an otherwise equal match — cheaper and far
|
|
9
|
+
* more predictable than trying to express priority through Fuse's own field weights.
|
|
10
|
+
*/
|
|
11
|
+
export declare function rankDocs({ docs, fields, fuzzy, query, }: {
|
|
12
|
+
docs: IndexedDoc[];
|
|
13
|
+
fields?: SearchField[];
|
|
14
|
+
fuzzy?: FuzzyOptions;
|
|
15
|
+
query: string;
|
|
16
|
+
}): {
|
|
17
|
+
doc: IndexedDoc;
|
|
18
|
+
score: number;
|
|
19
|
+
}[];
|
|
20
|
+
/** Bucket ranked documents into their groups, applying each group's cap. */
|
|
21
|
+
export declare function groupResults({ groups, ranked, }: {
|
|
22
|
+
groups: SearchGroup[];
|
|
23
|
+
ranked: {
|
|
24
|
+
doc: IndexedDoc;
|
|
25
|
+
score?: number;
|
|
26
|
+
}[];
|
|
27
|
+
}): GroupedResults;
|
|
28
|
+
/**
|
|
29
|
+
* The empty-query preset.
|
|
30
|
+
*
|
|
31
|
+
* Ordered by collection weight and then alphabetically, and only for groups that opted in. Callers
|
|
32
|
+
* that want a curated list should configure weights — this is explicitly not popularity-ranked,
|
|
33
|
+
* and saying so here is cheaper than a client learning it later.
|
|
34
|
+
*/
|
|
35
|
+
export declare function presetResults({ docs, groups, }: {
|
|
36
|
+
docs: IndexedDoc[];
|
|
37
|
+
groups: SearchGroup[];
|
|
38
|
+
}): GroupedResults;
|
package/dist/rank.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import Fuse from 'fuse.js';
|
|
2
|
+
import { hrefFor } from './project.js';
|
|
3
|
+
export const DEFAULT_FIELDS = [
|
|
4
|
+
{
|
|
5
|
+
name: 'title',
|
|
6
|
+
weight: 1
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'slug',
|
|
10
|
+
weight: 0.4
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'description',
|
|
14
|
+
weight: 0.2
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
export const DEFAULT_FUZZY = {
|
|
18
|
+
distance: 100,
|
|
19
|
+
// Two-character queries match too much to be useful; this is what stops a query like "tuni"
|
|
20
|
+
// pulling documents that merely contain those letters somewhere in a description.
|
|
21
|
+
minMatchCharLength: 3,
|
|
22
|
+
threshold: 0.35
|
|
23
|
+
};
|
|
24
|
+
const toResult = (doc, score)=>({
|
|
25
|
+
id: doc.id,
|
|
26
|
+
collection: doc.collection,
|
|
27
|
+
group: doc.group,
|
|
28
|
+
href: hrefFor(doc),
|
|
29
|
+
icon: doc.icon,
|
|
30
|
+
score,
|
|
31
|
+
title: doc.title
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Rank documents against a query.
|
|
35
|
+
*
|
|
36
|
+
* Fuse gives fuzzy tolerance for typos, plurals and word order. Its score is then divided by the
|
|
37
|
+
* collection weight so a configured priority can lift an otherwise equal match — cheaper and far
|
|
38
|
+
* more predictable than trying to express priority through Fuse's own field weights.
|
|
39
|
+
*/ export function rankDocs({ docs, fields = DEFAULT_FIELDS, fuzzy, query }) {
|
|
40
|
+
const trimmed = query.trim();
|
|
41
|
+
if (!trimmed) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const options = {
|
|
45
|
+
...DEFAULT_FUZZY,
|
|
46
|
+
...fuzzy
|
|
47
|
+
};
|
|
48
|
+
const fuse = new Fuse(docs, {
|
|
49
|
+
distance: options.distance,
|
|
50
|
+
ignoreLocation: true,
|
|
51
|
+
includeScore: true,
|
|
52
|
+
keys: fields.map((field)=>({
|
|
53
|
+
name: field.name,
|
|
54
|
+
weight: field.weight ?? 1
|
|
55
|
+
})),
|
|
56
|
+
minMatchCharLength: options.minMatchCharLength,
|
|
57
|
+
threshold: options.threshold
|
|
58
|
+
});
|
|
59
|
+
return fuse.search(trimmed).map((hit)=>({
|
|
60
|
+
doc: hit.item,
|
|
61
|
+
// Fuse scores are "lower is better", so dividing by weight promotes a heavier collection.
|
|
62
|
+
score: (hit.score ?? 1) / (hit.item.weight || 1)
|
|
63
|
+
})).sort((a, b)=>a.score - b.score);
|
|
64
|
+
}
|
|
65
|
+
/** Bucket ranked documents into their groups, applying each group's cap. */ export function groupResults({ groups, ranked }) {
|
|
66
|
+
const bySlug = new Map(groups.map((group)=>[
|
|
67
|
+
group.slug,
|
|
68
|
+
group
|
|
69
|
+
]));
|
|
70
|
+
const grouped = {};
|
|
71
|
+
for (const group of groups){
|
|
72
|
+
grouped[group.slug] = [];
|
|
73
|
+
}
|
|
74
|
+
for (const { doc, score } of ranked){
|
|
75
|
+
const group = bySlug.get(doc.group);
|
|
76
|
+
if (!group) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const bucket = grouped[group.slug];
|
|
80
|
+
if (group.limit !== undefined && bucket.length >= group.limit) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
bucket.push(toResult(doc, score));
|
|
84
|
+
}
|
|
85
|
+
return grouped;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The empty-query preset.
|
|
89
|
+
*
|
|
90
|
+
* Ordered by collection weight and then alphabetically, and only for groups that opted in. Callers
|
|
91
|
+
* that want a curated list should configure weights — this is explicitly not popularity-ranked,
|
|
92
|
+
* and saying so here is cheaper than a client learning it later.
|
|
93
|
+
*/ export function presetResults({ docs, groups }) {
|
|
94
|
+
const eligible = new Set(groups.filter((group)=>group.showWhenEmpty !== false).map((group)=>group.slug));
|
|
95
|
+
const ordered = docs.filter((doc)=>eligible.has(doc.group)).sort((a, b)=>b.weight - a.weight || a.title.localeCompare(b.title)).map((doc)=>({
|
|
96
|
+
doc
|
|
97
|
+
}));
|
|
98
|
+
const grouped = groupResults({
|
|
99
|
+
groups,
|
|
100
|
+
ranked: ordered
|
|
101
|
+
});
|
|
102
|
+
for (const group of groups){
|
|
103
|
+
if (!eligible.has(group.slug)) {
|
|
104
|
+
grouped[group.slug] = [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return grouped;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=rank.js.map
|
package/dist/rank.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rank.ts"],"sourcesContent":["import Fuse from 'fuse.js'\n\nimport type {\n FuzzyOptions,\n GroupedResults,\n IndexedDoc,\n SearchField,\n SearchGroup,\n SearchResult,\n} from './types.js'\n\nimport { hrefFor } from './project.js'\n\nexport const DEFAULT_FIELDS: SearchField[] = [\n { name: 'title', weight: 1 },\n { name: 'slug', weight: 0.4 },\n { name: 'description', weight: 0.2 },\n]\n\nexport const DEFAULT_FUZZY: Required<FuzzyOptions> = {\n distance: 100,\n // Two-character queries match too much to be useful; this is what stops a query like \"tuni\"\n // pulling documents that merely contain those letters somewhere in a description.\n minMatchCharLength: 3,\n threshold: 0.35,\n}\n\nconst toResult = (doc: IndexedDoc, score?: number): SearchResult => ({\n id: doc.id,\n collection: doc.collection,\n group: doc.group,\n href: hrefFor(doc),\n icon: doc.icon,\n score,\n title: doc.title,\n})\n\n/**\n * Rank documents against a query.\n *\n * Fuse gives fuzzy tolerance for typos, plurals and word order. Its score is then divided by the\n * collection weight so a configured priority can lift an otherwise equal match — cheaper and far\n * more predictable than trying to express priority through Fuse's own field weights.\n */\nexport function rankDocs({\n docs,\n fields = DEFAULT_FIELDS,\n fuzzy,\n query,\n}: {\n docs: IndexedDoc[]\n fields?: SearchField[]\n fuzzy?: FuzzyOptions\n query: string\n}): { doc: IndexedDoc; score: number }[] {\n const trimmed = query.trim()\n if (!trimmed) {\n return []\n }\n\n const options = { ...DEFAULT_FUZZY, ...fuzzy }\n\n const fuse = new Fuse(docs, {\n distance: options.distance,\n ignoreLocation: true,\n includeScore: true,\n keys: fields.map((field) => ({ name: field.name, weight: field.weight ?? 1 })),\n minMatchCharLength: options.minMatchCharLength,\n threshold: options.threshold,\n })\n\n return fuse\n .search(trimmed)\n .map((hit) => ({\n doc: hit.item,\n // Fuse scores are \"lower is better\", so dividing by weight promotes a heavier collection.\n score: (hit.score ?? 1) / (hit.item.weight || 1),\n }))\n .sort((a, b) => a.score - b.score)\n}\n\n/** Bucket ranked documents into their groups, applying each group's cap. */\nexport function groupResults({\n groups,\n ranked,\n}: {\n groups: SearchGroup[]\n ranked: { doc: IndexedDoc; score?: number }[]\n}): GroupedResults {\n const bySlug = new Map(groups.map((group) => [group.slug, group]))\n const grouped: GroupedResults = {}\n\n for (const group of groups) {\n grouped[group.slug] = []\n }\n\n for (const { doc, score } of ranked) {\n const group = bySlug.get(doc.group)\n if (!group) {\n continue\n }\n\n const bucket = grouped[group.slug]\n if (group.limit !== undefined && bucket.length >= group.limit) {\n continue\n }\n\n bucket.push(toResult(doc, score))\n }\n\n return grouped\n}\n\n/**\n * The empty-query preset.\n *\n * Ordered by collection weight and then alphabetically, and only for groups that opted in. Callers\n * that want a curated list should configure weights — this is explicitly not popularity-ranked,\n * and saying so here is cheaper than a client learning it later.\n */\nexport function presetResults({\n docs,\n groups,\n}: {\n docs: IndexedDoc[]\n groups: SearchGroup[]\n}): GroupedResults {\n const eligible = new Set(\n groups.filter((group) => group.showWhenEmpty !== false).map((group) => group.slug),\n )\n\n const ordered = docs\n .filter((doc) => eligible.has(doc.group))\n .sort((a, b) => b.weight - a.weight || a.title.localeCompare(b.title))\n .map((doc) => ({ doc }))\n\n const grouped = groupResults({ groups, ranked: ordered })\n\n for (const group of groups) {\n if (!eligible.has(group.slug)) {\n grouped[group.slug] = []\n }\n }\n\n return grouped\n}\n"],"names":["Fuse","hrefFor","DEFAULT_FIELDS","name","weight","DEFAULT_FUZZY","distance","minMatchCharLength","threshold","toResult","doc","score","id","collection","group","href","icon","title","rankDocs","docs","fields","fuzzy","query","trimmed","trim","options","fuse","ignoreLocation","includeScore","keys","map","field","search","hit","item","sort","a","b","groupResults","groups","ranked","bySlug","Map","slug","grouped","get","bucket","limit","undefined","length","push","presetResults","eligible","Set","filter","showWhenEmpty","ordered","has","localeCompare"],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Payload } from 'payload';
|
|
2
|
+
import type { SearchIndexCache } from './cache.js';
|
|
3
|
+
import type { GroupedResults, IndexReport, SearchPluginConfig } from './types.js';
|
|
4
|
+
export type SearchService = {
|
|
5
|
+
inspect: () => Promise<IndexReport>;
|
|
6
|
+
reindex: () => Promise<{
|
|
7
|
+
indexed: number;
|
|
8
|
+
skipped: number;
|
|
9
|
+
}>;
|
|
10
|
+
search: (query: string) => Promise<GroupedResults>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Build the read path.
|
|
14
|
+
*
|
|
15
|
+
* The projection is cached, so a burst of keystrokes costs one index read rather than one per
|
|
16
|
+
* request per collection. `reindex` drops the snapshot and rebuilds immediately, which is what
|
|
17
|
+
* makes the CMS button meaningful — hook-driven sync always desyncs eventually (a bulk migration
|
|
18
|
+
* write, a restore from backup, a failed hook), and the recovery path has to be operable by an
|
|
19
|
+
* editor rather than a developer.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createSearchService({ cache, config, payload, }: {
|
|
22
|
+
cache: SearchIndexCache;
|
|
23
|
+
config: SearchPluginConfig;
|
|
24
|
+
payload: Payload;
|
|
25
|
+
}): SearchService;
|
package/dist/resolve.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { projectDocs } from './project.js';
|
|
2
|
+
import { groupResults, presetResults, rankDocs } from './rank.js';
|
|
3
|
+
/**
|
|
4
|
+
* The collection plugin-search maintains. Reading it rather than the source collections is the
|
|
5
|
+
* whole point: one query instead of one per collection, and sync is already solved by the hooks
|
|
6
|
+
* plugin-search installs.
|
|
7
|
+
*/ const SEARCH_COLLECTION = 'search';
|
|
8
|
+
/**
|
|
9
|
+
* Build the read path.
|
|
10
|
+
*
|
|
11
|
+
* The projection is cached, so a burst of keystrokes costs one index read rather than one per
|
|
12
|
+
* request per collection. `reindex` drops the snapshot and rebuilds immediately, which is what
|
|
13
|
+
* makes the CMS button meaningful — hook-driven sync always desyncs eventually (a bulk migration
|
|
14
|
+
* write, a restore from backup, a failed hook), and the recovery path has to be operable by an
|
|
15
|
+
* editor rather than a developer.
|
|
16
|
+
*/ export function createSearchService({ cache, config, payload }) {
|
|
17
|
+
const decode = config.decodeEntities ?? true;
|
|
18
|
+
const load = async ()=>{
|
|
19
|
+
const response = await payload.find({
|
|
20
|
+
collection: SEARCH_COLLECTION,
|
|
21
|
+
depth: 0,
|
|
22
|
+
limit: 0,
|
|
23
|
+
pagination: false
|
|
24
|
+
});
|
|
25
|
+
return projectDocs({
|
|
26
|
+
collections: config.collections,
|
|
27
|
+
decode,
|
|
28
|
+
rows: response.docs
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const docs = async ()=>{
|
|
32
|
+
const cached = cache.get();
|
|
33
|
+
if (cached) {
|
|
34
|
+
return cached;
|
|
35
|
+
}
|
|
36
|
+
const { docs: fresh } = await load();
|
|
37
|
+
cache.set(fresh);
|
|
38
|
+
return fresh;
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
async inspect () {
|
|
42
|
+
const { docs: fresh, skipped } = await load();
|
|
43
|
+
cache.set(fresh);
|
|
44
|
+
return {
|
|
45
|
+
builtAt: cache.builtAt() ? new Date(cache.builtAt()).toISOString() : null,
|
|
46
|
+
collections: config.collections.map((entry)=>({
|
|
47
|
+
slug: entry.slug,
|
|
48
|
+
excluded: skipped.filter((row)=>row.slug === entry.slug).length,
|
|
49
|
+
indexed: fresh.filter((doc)=>doc.collection === entry.slug).length
|
|
50
|
+
})),
|
|
51
|
+
skipped,
|
|
52
|
+
total: fresh.length
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
async reindex () {
|
|
56
|
+
cache.invalidate();
|
|
57
|
+
const { docs: fresh, skipped } = await load();
|
|
58
|
+
cache.set(fresh);
|
|
59
|
+
return {
|
|
60
|
+
indexed: fresh.length,
|
|
61
|
+
skipped: skipped.length
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
async search (query) {
|
|
65
|
+
const all = await docs();
|
|
66
|
+
const trimmed = query.trim();
|
|
67
|
+
if (!trimmed) {
|
|
68
|
+
return presetResults({
|
|
69
|
+
docs: all,
|
|
70
|
+
groups: config.groups
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return groupResults({
|
|
74
|
+
groups: config.groups,
|
|
75
|
+
ranked: rankDocs({
|
|
76
|
+
docs: all,
|
|
77
|
+
fields: config.fields,
|
|
78
|
+
fuzzy: config.fuzzy,
|
|
79
|
+
query: trimmed
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resolve.ts"],"sourcesContent":["import type { Payload } from 'payload'\n\nimport type { SearchIndexCache } from './cache.js'\nimport type { SearchDoc } from './project.js'\nimport type { GroupedResults, IndexedDoc, IndexReport, SearchPluginConfig } from './types.js'\n\nimport { projectDocs } from './project.js'\nimport { groupResults, presetResults, rankDocs } from './rank.js'\n\n/**\n * The collection plugin-search maintains. Reading it rather than the source collections is the\n * whole point: one query instead of one per collection, and sync is already solved by the hooks\n * plugin-search installs.\n */\nconst SEARCH_COLLECTION = 'search'\n\nexport type SearchService = {\n inspect: () => Promise<IndexReport>\n reindex: () => Promise<{ indexed: number; skipped: number }>\n search: (query: string) => Promise<GroupedResults>\n}\n\n/**\n * Build the read path.\n *\n * The projection is cached, so a burst of keystrokes costs one index read rather than one per\n * request per collection. `reindex` drops the snapshot and rebuilds immediately, which is what\n * makes the CMS button meaningful — hook-driven sync always desyncs eventually (a bulk migration\n * write, a restore from backup, a failed hook), and the recovery path has to be operable by an\n * editor rather than a developer.\n */\nexport function createSearchService({\n cache,\n config,\n payload,\n}: {\n cache: SearchIndexCache\n config: SearchPluginConfig\n payload: Payload\n}): SearchService {\n const decode = config.decodeEntities ?? true\n\n const load = async (): Promise<{\n docs: IndexedDoc[]\n skipped: IndexReport['skipped']\n }> => {\n const response = await payload.find({\n collection: SEARCH_COLLECTION as never,\n depth: 0,\n limit: 0,\n pagination: false,\n })\n\n return projectDocs({\n collections: config.collections,\n decode,\n rows: response.docs as SearchDoc[],\n })\n }\n\n const docs = async (): Promise<IndexedDoc[]> => {\n const cached = cache.get()\n if (cached) {\n return cached\n }\n\n const { docs: fresh } = await load()\n cache.set(fresh)\n return fresh\n }\n\n return {\n async inspect() {\n const { docs: fresh, skipped } = await load()\n cache.set(fresh)\n\n return {\n builtAt: cache.builtAt() ? new Date(cache.builtAt() as number).toISOString() : null,\n collections: config.collections.map((entry) => ({\n slug: entry.slug,\n excluded: skipped.filter((row) => row.slug === entry.slug).length,\n indexed: fresh.filter((doc) => doc.collection === entry.slug).length,\n })),\n skipped,\n total: fresh.length,\n }\n },\n\n async reindex() {\n cache.invalidate()\n const { docs: fresh, skipped } = await load()\n cache.set(fresh)\n return { indexed: fresh.length, skipped: skipped.length }\n },\n\n async search(query: string) {\n const all = await docs()\n const trimmed = query.trim()\n\n if (!trimmed) {\n return presetResults({ docs: all, groups: config.groups })\n }\n\n return groupResults({\n groups: config.groups,\n ranked: rankDocs({\n docs: all,\n fields: config.fields,\n fuzzy: config.fuzzy,\n query: trimmed,\n }),\n })\n },\n }\n}\n"],"names":["projectDocs","groupResults","presetResults","rankDocs","SEARCH_COLLECTION","createSearchService","cache","config","payload","decode","decodeEntities","load","response","find","collection","depth","limit","pagination","collections","rows","docs","cached","get","fresh","set","inspect","skipped","builtAt","Date","toISOString","map","entry","slug","excluded","filter","row","length","indexed","doc","total","reindex","invalidate","search","query","all","trimmed","trim","groups","ranked","fields","fuzzy"],"mappings":"AAMA,SAASA,WAAW,QAAQ,eAAc;AAC1C,SAASC,YAAY,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,YAAW;AAEjE;;;;CAIC,GACD,MAAMC,oBAAoB;AAQ1B;;;;;;;;CAQC,GACD,OAAO,SAASC,oBAAoB,EAClCC,KAAK,EACLC,MAAM,EACNC,OAAO,EAKR;IACC,MAAMC,SAASF,OAAOG,cAAc,IAAI;IAExC,MAAMC,OAAO;QAIX,MAAMC,WAAW,MAAMJ,QAAQK,IAAI,CAAC;YAClCC,YAAYV;YACZW,OAAO;YACPC,OAAO;YACPC,YAAY;QACd;QAEA,OAAOjB,YAAY;YACjBkB,aAAaX,OAAOW,WAAW;YAC/BT;YACAU,MAAMP,SAASQ,IAAI;QACrB;IACF;IAEA,MAAMA,OAAO;QACX,MAAMC,SAASf,MAAMgB,GAAG;QACxB,IAAID,QAAQ;YACV,OAAOA;QACT;QAEA,MAAM,EAAED,MAAMG,KAAK,EAAE,GAAG,MAAMZ;QAC9BL,MAAMkB,GAAG,CAACD;QACV,OAAOA;IACT;IAEA,OAAO;QACL,MAAME;YACJ,MAAM,EAAEL,MAAMG,KAAK,EAAEG,OAAO,EAAE,GAAG,MAAMf;YACvCL,MAAMkB,GAAG,CAACD;YAEV,OAAO;gBACLI,SAASrB,MAAMqB,OAAO,KAAK,IAAIC,KAAKtB,MAAMqB,OAAO,IAAcE,WAAW,KAAK;gBAC/EX,aAAaX,OAAOW,WAAW,CAACY,GAAG,CAAC,CAACC,QAAW,CAAA;wBAC9CC,MAAMD,MAAMC,IAAI;wBAChBC,UAAUP,QAAQQ,MAAM,CAAC,CAACC,MAAQA,IAAIH,IAAI,KAAKD,MAAMC,IAAI,EAAEI,MAAM;wBACjEC,SAASd,MAAMW,MAAM,CAAC,CAACI,MAAQA,IAAIxB,UAAU,KAAKiB,MAAMC,IAAI,EAAEI,MAAM;oBACtE,CAAA;gBACAV;gBACAa,OAAOhB,MAAMa,MAAM;YACrB;QACF;QAEA,MAAMI;YACJlC,MAAMmC,UAAU;YAChB,MAAM,EAAErB,MAAMG,KAAK,EAAEG,OAAO,EAAE,GAAG,MAAMf;YACvCL,MAAMkB,GAAG,CAACD;YACV,OAAO;gBAAEc,SAASd,MAAMa,MAAM;gBAAEV,SAASA,QAAQU,MAAM;YAAC;QAC1D;QAEA,MAAMM,QAAOC,KAAa;YACxB,MAAMC,MAAM,MAAMxB;YAClB,MAAMyB,UAAUF,MAAMG,IAAI;YAE1B,IAAI,CAACD,SAAS;gBACZ,OAAO3C,cAAc;oBAAEkB,MAAMwB;oBAAKG,QAAQxC,OAAOwC,MAAM;gBAAC;YAC1D;YAEA,OAAO9C,aAAa;gBAClB8C,QAAQxC,OAAOwC,MAAM;gBACrBC,QAAQ7C,SAAS;oBACfiB,MAAMwB;oBACNK,QAAQ1C,OAAO0C,MAAM;oBACrBC,OAAO3C,OAAO2C,KAAK;oBACnBP,OAAOE;gBACT;YACF;QACF;IACF;AACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { CollectionSlug } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* A collection that should appear in site search, and how its results present.
|
|
4
|
+
*
|
|
5
|
+
* Everything a host project would otherwise hardcode lives here: which group a collection lands
|
|
6
|
+
* in, how its URLs are built, how strongly it ranks, and which documents are held back.
|
|
7
|
+
*/
|
|
8
|
+
export type SearchableCollection = {
|
|
9
|
+
/** Documents whose slug appears here are never returned. */
|
|
10
|
+
excludeSlugs?: string[];
|
|
11
|
+
/** Group key this collection's results are filed under. Must match a configured group. */
|
|
12
|
+
group: string;
|
|
13
|
+
/** Opaque icon token passed through to the consumer's own icon map. */
|
|
14
|
+
icon?: string;
|
|
15
|
+
/**
|
|
16
|
+
* URL prefix for a result, without a trailing slash. Use an empty string for collections served
|
|
17
|
+
* at the site root — it is deliberately distinct from "unset".
|
|
18
|
+
*/
|
|
19
|
+
path: string;
|
|
20
|
+
slug: CollectionSlug;
|
|
21
|
+
/**
|
|
22
|
+
* Ranking multiplier relative to other collections. 1 is neutral; raise it to float a
|
|
23
|
+
* collection's matches above equally-good matches elsewhere.
|
|
24
|
+
*/
|
|
25
|
+
weight?: number;
|
|
26
|
+
};
|
|
27
|
+
/** A presentation group that results are bucketed into. */
|
|
28
|
+
export type SearchGroup = {
|
|
29
|
+
/** Human label. The plugin never renders it, but ships it so consumers stay consistent. */
|
|
30
|
+
label: string;
|
|
31
|
+
/** Maximum results returned for this group. Omit for no cap. */
|
|
32
|
+
limit?: number;
|
|
33
|
+
/** Sort position in the returned group list. Lower comes first. */
|
|
34
|
+
order?: number;
|
|
35
|
+
/** Whether this group appears in the empty-query preset list. */
|
|
36
|
+
showWhenEmpty?: boolean;
|
|
37
|
+
slug: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A field on the indexed document to match against, with a relative weight.
|
|
41
|
+
*
|
|
42
|
+
* Weights are what stop the "search for tuni, get unrelated results" class of complaint: a title
|
|
43
|
+
* hit and an incidental description hit stop being treated identically.
|
|
44
|
+
*/
|
|
45
|
+
export type SearchField = {
|
|
46
|
+
name: string;
|
|
47
|
+
weight?: number;
|
|
48
|
+
};
|
|
49
|
+
export type FuzzyOptions = {
|
|
50
|
+
/** Character distance a match may drift from the expected location. */
|
|
51
|
+
distance?: number;
|
|
52
|
+
/** Shortest run of characters that counts as a match. Guards against 1-2 letter noise. */
|
|
53
|
+
minMatchCharLength?: number;
|
|
54
|
+
/** 0 demands a perfect match, 1 matches anything. */
|
|
55
|
+
threshold?: number;
|
|
56
|
+
};
|
|
57
|
+
export type AnalyticsOptions = {
|
|
58
|
+
/** Collection slug for stored events. */
|
|
59
|
+
collectionSlug?: string;
|
|
60
|
+
enabled?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Days to keep events. Events older than this are pruned on write rather than accumulating an
|
|
63
|
+
* unbounded log.
|
|
64
|
+
*/
|
|
65
|
+
retentionDays?: number;
|
|
66
|
+
};
|
|
67
|
+
export type SearchPluginConfig = {
|
|
68
|
+
analytics?: AnalyticsOptions | boolean;
|
|
69
|
+
/** Milliseconds to hold the projected index in memory. */
|
|
70
|
+
cacheTTL?: number;
|
|
71
|
+
collections: SearchableCollection[];
|
|
72
|
+
/**
|
|
73
|
+
* Decode HTML entities in titles before returning them. Content migrated out of a CMS that
|
|
74
|
+
* stored encoded markup will otherwise surface "&" as literal text wherever a result is
|
|
75
|
+
* rendered as plain text.
|
|
76
|
+
*/
|
|
77
|
+
decodeEntities?: boolean;
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
/** Fields matched against, with relative weights. */
|
|
80
|
+
fields?: SearchField[];
|
|
81
|
+
fuzzy?: FuzzyOptions;
|
|
82
|
+
groups: SearchGroup[];
|
|
83
|
+
/** Restrict the reindex and inspect endpoints to admin users. */
|
|
84
|
+
requireAdminForOperations?: boolean;
|
|
85
|
+
/** Base path for the plugin's endpoints. */
|
|
86
|
+
routePrefix?: string;
|
|
87
|
+
};
|
|
88
|
+
/** One document as held in the in-memory projection. */
|
|
89
|
+
export type IndexedDoc = {
|
|
90
|
+
collection: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
group: string;
|
|
93
|
+
icon?: string;
|
|
94
|
+
id: string;
|
|
95
|
+
path: string;
|
|
96
|
+
slug: string;
|
|
97
|
+
title: string;
|
|
98
|
+
weight: number;
|
|
99
|
+
};
|
|
100
|
+
export type SearchResult = {
|
|
101
|
+
collection: string;
|
|
102
|
+
group: string;
|
|
103
|
+
href: string;
|
|
104
|
+
icon?: string;
|
|
105
|
+
id: string;
|
|
106
|
+
/** Fuse score, carried through so consumers can debug ranking. Lower is a better match. */
|
|
107
|
+
score?: number;
|
|
108
|
+
title: string;
|
|
109
|
+
};
|
|
110
|
+
export type GroupedResults = Record<string, SearchResult[]>;
|
|
111
|
+
/** What the inspector reports, so "is this searchable" stops needing a code read. */
|
|
112
|
+
export type IndexReport = {
|
|
113
|
+
builtAt: null | string;
|
|
114
|
+
collections: {
|
|
115
|
+
excluded: number;
|
|
116
|
+
indexed: number;
|
|
117
|
+
slug: string;
|
|
118
|
+
}[];
|
|
119
|
+
skipped: {
|
|
120
|
+
id: string;
|
|
121
|
+
reason: string;
|
|
122
|
+
slug: string;
|
|
123
|
+
}[];
|
|
124
|
+
total: number;
|
|
125
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionSlug } from 'payload'\n\n/**\n * A collection that should appear in site search, and how its results present.\n *\n * Everything a host project would otherwise hardcode lives here: which group a collection lands\n * in, how its URLs are built, how strongly it ranks, and which documents are held back.\n */\nexport type SearchableCollection = {\n /** Documents whose slug appears here are never returned. */\n excludeSlugs?: string[]\n /** Group key this collection's results are filed under. Must match a configured group. */\n group: string\n /** Opaque icon token passed through to the consumer's own icon map. */\n icon?: string\n /**\n * URL prefix for a result, without a trailing slash. Use an empty string for collections served\n * at the site root — it is deliberately distinct from \"unset\".\n */\n path: string\n slug: CollectionSlug\n /**\n * Ranking multiplier relative to other collections. 1 is neutral; raise it to float a\n * collection's matches above equally-good matches elsewhere.\n */\n weight?: number\n}\n\n/** A presentation group that results are bucketed into. */\nexport type SearchGroup = {\n /** Human label. The plugin never renders it, but ships it so consumers stay consistent. */\n label: string\n /** Maximum results returned for this group. Omit for no cap. */\n limit?: number\n /** Sort position in the returned group list. Lower comes first. */\n order?: number\n /** Whether this group appears in the empty-query preset list. */\n showWhenEmpty?: boolean\n slug: string\n}\n\n/**\n * A field on the indexed document to match against, with a relative weight.\n *\n * Weights are what stop the \"search for tuni, get unrelated results\" class of complaint: a title\n * hit and an incidental description hit stop being treated identically.\n */\nexport type SearchField = {\n name: string\n weight?: number\n}\n\nexport type FuzzyOptions = {\n /** Character distance a match may drift from the expected location. */\n distance?: number\n /** Shortest run of characters that counts as a match. Guards against 1-2 letter noise. */\n minMatchCharLength?: number\n /** 0 demands a perfect match, 1 matches anything. */\n threshold?: number\n}\n\nexport type AnalyticsOptions = {\n /** Collection slug for stored events. */\n collectionSlug?: string\n enabled?: boolean\n /**\n * Days to keep events. Events older than this are pruned on write rather than accumulating an\n * unbounded log.\n */\n retentionDays?: number\n}\n\nexport type SearchPluginConfig = {\n analytics?: AnalyticsOptions | boolean\n /** Milliseconds to hold the projected index in memory. */\n cacheTTL?: number\n collections: SearchableCollection[]\n /**\n * Decode HTML entities in titles before returning them. Content migrated out of a CMS that\n * stored encoded markup will otherwise surface \"&\" as literal text wherever a result is\n * rendered as plain text.\n */\n decodeEntities?: boolean\n disabled?: boolean\n /** Fields matched against, with relative weights. */\n fields?: SearchField[]\n fuzzy?: FuzzyOptions\n groups: SearchGroup[]\n /** Restrict the reindex and inspect endpoints to admin users. */\n requireAdminForOperations?: boolean\n /** Base path for the plugin's endpoints. */\n routePrefix?: string\n}\n\n/** One document as held in the in-memory projection. */\nexport type IndexedDoc = {\n collection: string\n description?: string\n group: string\n icon?: string\n id: string\n path: string\n slug: string\n title: string\n weight: number\n}\n\nexport type SearchResult = {\n collection: string\n group: string\n href: string\n icon?: string\n id: string\n /** Fuse score, carried through so consumers can debug ranking. Lower is a better match. */\n score?: number\n title: string\n}\n\nexport type GroupedResults = Record<string, SearchResult[]>\n\n/** What the inspector reports, so \"is this searchable\" stops needing a code read. */\nexport type IndexReport = {\n builtAt: null | string\n collections: {\n excluded: number\n indexed: number\n slug: string\n }[]\n skipped: {\n id: string\n reason: string\n slug: string\n }[]\n total: number\n}\n"],"names":[],"mappings":"AAwHA,mFAAmF,GACnF,WAaC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@foundrykit/search-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A plugin for Payload CMS that provides a cached, grouped and ranked site search over the plugin-search index, with fuzzy matching, editor-controlled relevance and search analytics.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Isaac SJ",
|
|
9
|
+
"email": "isaac@umidigital.co.uk"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"payload",
|
|
13
|
+
"payloadcms",
|
|
14
|
+
"plugin",
|
|
15
|
+
"search",
|
|
16
|
+
"fuse",
|
|
17
|
+
"analytics"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./client": {
|
|
26
|
+
"import": "./dist/exports/client.js",
|
|
27
|
+
"types": "./dist/exports/client.d.ts",
|
|
28
|
+
"default": "./dist/exports/client.js"
|
|
29
|
+
},
|
|
30
|
+
"./rsc": {
|
|
31
|
+
"import": "./dist/exports/rsc.js",
|
|
32
|
+
"types": "./dist/exports/rsc.d.ts",
|
|
33
|
+
"default": "./dist/exports/rsc.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"main": "./dist/index.js",
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"files": [
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "pnpm clean && pnpm copyfiles && pnpm build:types && pnpm build:swc",
|
|
43
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths --ignore \"**/*.test.ts,**/*.test.tsx\"",
|
|
44
|
+
"build:types": "tsc --outDir dist --rootDir ./src",
|
|
45
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
46
|
+
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
47
|
+
"lint": "eslint",
|
|
48
|
+
"lint:fix": "eslint ./src --fix",
|
|
49
|
+
"test": "pnpm test:unit",
|
|
50
|
+
"test:unit": "vitest run",
|
|
51
|
+
"release": "release-it"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"fuse.js": "^7.1.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
58
|
+
"@payloadcms/eslint-config": "3.9.0",
|
|
59
|
+
"@payloadcms/plugin-search": "3.37.0",
|
|
60
|
+
"@payloadcms/ui": "3.37.0",
|
|
61
|
+
"@release-it/conventional-changelog": "^10.0.5",
|
|
62
|
+
"@swc/cli": "0.6.0",
|
|
63
|
+
"@types/node": "22.19.9",
|
|
64
|
+
"@types/react": "19.2.9",
|
|
65
|
+
"copyfiles": "2.4.1",
|
|
66
|
+
"cross-env": "^7.0.3",
|
|
67
|
+
"eslint": "^9.23.0",
|
|
68
|
+
"payload": "3.37.0",
|
|
69
|
+
"prettier": "^3.4.2",
|
|
70
|
+
"react": "19.2.1",
|
|
71
|
+
"release-it": "^19.2.4",
|
|
72
|
+
"rimraf": "3.0.2",
|
|
73
|
+
"typescript": "5.7.3",
|
|
74
|
+
"vitest": "4.0.18"
|
|
75
|
+
},
|
|
76
|
+
"peerDependencies": {
|
|
77
|
+
"@payloadcms/plugin-search": "^3.37.0",
|
|
78
|
+
"payload": "^3.37.0",
|
|
79
|
+
"react": "^19.0.0"
|
|
80
|
+
},
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": "^18.20.2 || >=20.9.0",
|
|
83
|
+
"pnpm": "^9 || ^10"
|
|
84
|
+
},
|
|
85
|
+
"publishConfig": {
|
|
86
|
+
"access": "public"
|
|
87
|
+
},
|
|
88
|
+
"repository": {
|
|
89
|
+
"type": "git",
|
|
90
|
+
"url": "https://github.com/umi-labs/search-plugin"
|
|
91
|
+
},
|
|
92
|
+
"bugs": {
|
|
93
|
+
"url": "https://github.com/umi-labs/search-plugin/issues"
|
|
94
|
+
},
|
|
95
|
+
"homepage": "https://github.com/umi-labs/search-plugin#readme"
|
|
96
|
+
}
|