|
|
|
@ -28,7 +28,7 @@ class Misc extends Controller {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const query = String(req.query.query)
|
|
|
|
|
const snip_length = 50
|
|
|
|
|
const snip_length = 100
|
|
|
|
|
|
|
|
|
|
const Page = this.models.get('api:Page')
|
|
|
|
|
const Node = this.models.get('api:Node')
|
|
|
|
@ -49,7 +49,7 @@ class Misc extends Controller {
|
|
|
|
|
for ( const page of matching_pages ) {
|
|
|
|
|
results.push({
|
|
|
|
|
title: page.Name,
|
|
|
|
|
short_title: `${page.Name.slice(0, snip_length)}${page.Name.length > snip_length ? '...' : ''}`,
|
|
|
|
|
short_title: `${page.Name.replace(/(<([^>]+)>)/ig, '').slice(0, snip_length)}${page.Name.length > snip_length ? '...' : ''}`,
|
|
|
|
|
type: 'page',
|
|
|
|
|
id: page.UUID,
|
|
|
|
|
})
|
|
|
|
@ -65,7 +65,7 @@ class Misc extends Controller {
|
|
|
|
|
const page = await node.page
|
|
|
|
|
results.push({
|
|
|
|
|
title: node.Value.Value,
|
|
|
|
|
short_title: `${node.Value.Value.slice(0, snip_length)}${node.Value.Value.length > snip_length ? '...' : ''}`,
|
|
|
|
|
short_title: `${node.Value.Value.replace(/(<([^>]+)>)/ig, '').slice(0, snip_length)}${node.Value.Value.length > snip_length ? '...' : ''}`,
|
|
|
|
|
type: node.Value.Mode === 'norm' ? 'node' : 'markdown',
|
|
|
|
|
id: node.UUID,
|
|
|
|
|
associated: {
|
|
|
|
@ -87,7 +87,7 @@ class Misc extends Controller {
|
|
|
|
|
const page = await codium.page
|
|
|
|
|
results.push({
|
|
|
|
|
title: codium.code,
|
|
|
|
|
short_title: `${codium.code.slice(0, snip_length)}${codium.code.length > snip_length ? '...' : ''}`,
|
|
|
|
|
short_title: `${codium.code.replace(/(<([^>]+)>)/ig, '').slice(0, snip_length)}${codium.code.length > snip_length ? '...' : ''}`,
|
|
|
|
|
type: 'code',
|
|
|
|
|
id: codium.NodeId,
|
|
|
|
|
associated: {
|
|
|
|
@ -109,7 +109,7 @@ class Misc extends Controller {
|
|
|
|
|
const page = await db.page
|
|
|
|
|
results.push({
|
|
|
|
|
title: db.Name,
|
|
|
|
|
short_title: `${db.Name.slice(0, snip_length)}${db.Name.length > snip_length ? '...' : ''}`,
|
|
|
|
|
short_title: `${db.Name.replace(/(<([^>]+)>)/ig, '').slice(0, snip_length)}${db.Name.length > snip_length ? '...' : ''}`,
|
|
|
|
|
type: 'db',
|
|
|
|
|
id: db.NodeId,
|
|
|
|
|
associated: {
|
|
|
|
|