orama
orama copied to clipboard
OramaPlugin for vitepress, additional options.
Problem Description
At the moment, it looks like the plugin for vitepress only accepts analytics as a known options field. However, it looks like more options could be added, like schema, searchOptions, etc...
Proposed Solution
Currently, I was expecting this to work (without success) :
vite: {
plugins: [OramaPlugin({
schema: {
title: 'string',
content: 'string',
functionNames: 'string[]',
},
searchOptions: {
boost: {
title: 2,
functionNames: 3,
},
},
contentTransformer: (content) => {
// This regex matches patterns like Name.func1 or Name1.name2.func2
const regex = /(?:^|\s)((?:\w+\.)+(\w+))/g;
const matches = [...content.content.matchAll(regex)];
const functionNames = matches.map(match => match[2]); // Capture the last word after the period
return {
...content,
functionNames: [...new Set(functionNames)], // Remove duplicates
}
},
})],
},
any hints on how to achieved this? maybe a workaround?
Alternatives
No response
Additional Context
No response