Skip to content

Commit d871f0f

Browse files
committed
fix: references to old field names
1 parent f101c16 commit d871f0f

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

scripts/smart-search.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ async function main() {
4040
* @typedef {object} Page
4141
* @property {string} id //The unique identifier of the document.
4242
* @property {object} data //The data to be indexed.
43-
* @property {string} data.title //The title of the document.
44-
* @property {string} data.content //The text content of the document.
45-
* @property {string} data.path //A relative path to the document on the internet.
46-
* @property {string} data.content_type // The type of content. Always "mdx_doc".
43+
* @property {string} data.post_title //The title of the document.
44+
* @property {string} data.post_content //The text content of the document.
45+
* @property {string} data.post_url //A relative path to the document on the internet.
46+
* @property {string} data.post_type // The type of content. Always "mdx_doc".
4747
* @returns Page[]
4848
*/
4949
async function collectPages() {
@@ -130,7 +130,7 @@ async function deleteOldDocs() {
130130
const response = await graphql({
131131
query: queryDocuments,
132132
variables: {
133-
query: 'content_type:"mdx_doc"',
133+
query: 'post_type:"mdx_doc"',
134134
limit: 10,
135135
offset: totalCollected,
136136
},

src/lib/smart-search.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ export function normalizeSmartSearchResponse(results) {
4141
}
4242

4343
default: {
44-
throw new TypeError(
45-
`Unknown content type: ${data.content_type ?? data.post_type}`,
46-
);
44+
throw new TypeError(`Unknown content type: ${data.post_type}`);
4745
}
4846
}
4947
});

src/pages/api/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default async function handler(req, res) {
2525
query: $query
2626
semanticSearch: {
2727
searchBias: 5,
28-
fields: ["post_title", "post_content", "content"]
28+
fields: ["post_title", "post_content"]
2929
}
3030
) {
3131
total

0 commit comments

Comments
 (0)