From 2e0ec5d47a66da8980a084da195835996bd48634 Mon Sep 17 00:00:00 2001 From: Nonumpa Date: Sun, 2 Jan 2022 15:30:20 +0800 Subject: [PATCH 1/2] Add articleType and attachment for non-text articles --- schema/articles.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/schema/articles.js b/schema/articles.js index 4953c3b..3dbf9cc 100644 --- a/schema/articles.js +++ b/schema/articles.js @@ -1,4 +1,4 @@ -export const VERSION = '1.1.0'; +export const VERSION = '1.2.0'; export default { properties: { @@ -97,5 +97,16 @@ export default { updatedAt: { type: 'date' }, }, }, + + articleType: { type: 'keyword' }, // TEXT, IMAGE, VIDEO, AUDIO + + // There will be an attachment describing the file when articleType is not TEXT + attachment: { + type: 'nested', + properties: { + fileUrl: { type: 'keyword' }, // URL stores the original file + hash: { type: 'keyword' }, // hash (Perceptual Hash) for identifying two similar file + }, + }, }, }; From 1d024b3a417552e8cef5dac80c334ce690ca3736 Mon Sep 17 00:00:00 2001 From: Nonumpa Date: Mon, 3 Jan 2022 17:21:59 +0800 Subject: [PATCH 2/2] Use attachmentUrl + attachmentHash instead --- schema/articles.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/schema/articles.js b/schema/articles.js index 3dbf9cc..098ba7f 100644 --- a/schema/articles.js +++ b/schema/articles.js @@ -101,12 +101,7 @@ export default { articleType: { type: 'keyword' }, // TEXT, IMAGE, VIDEO, AUDIO // There will be an attachment describing the file when articleType is not TEXT - attachment: { - type: 'nested', - properties: { - fileUrl: { type: 'keyword' }, // URL stores the original file - hash: { type: 'keyword' }, // hash (Perceptual Hash) for identifying two similar file - }, - }, + attachmentUrl: { type: 'keyword' }, // URL stores the original file + attachmentHash: { type: 'keyword' }, // hash (Perceptual Hash) for identifying two similar file }, };