SeedCompany / cord-api-v3

Bible translation project management API
MIT License
18 stars 4 forks source link

Neo4j: FullTextIndex / .call() / .yield() #3250

Closed CarsonF closed 3 months ago

CarsonF commented 3 months ago

Full Text Index

This unifies how full text indexes are configured & then referenced.

const MyIndex = FullTextIndex({ ... });

Query.apply(MyIndex.create())
Query.call(MyIndex.search(...).yield('node'))

Previously the index name was a magic string referenced in multiple spots.

CALL / YIELD

Also added support for Query.call() & Query.yield(), which mostly just means we have less big string blocks.

.call('foo.bar.baz')
.call('foo.bar.baz', ['arg1'])
.yield('node')
.yield(['node', 'score'])
.yield('node as result')
.yield({
  node: 'result',
  score: 'rank',
})

Procedures can be declared with procedure() which provides more strict types.

.call(
  apoc.create.setLabels('node', res.dbLabels)
    .yield({ node: 'labelsAdded' })
)

Fixes