Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
histhub
linker
Commits
ba8ab9c0
Commit
ba8ab9c0
authored
Nov 12, 2019
by
Tobinsk
Browse files
Merge branch '4-ensure-index-exists' into 'master'
Generate an unique index for place.uri Closes
#4
See merge request
!8
parents
824c9469
a19f663e
Changes
1
Show whitespace changes
Inline
Side-by-side
src/index.ts
View file @
ba8ab9c0
...
...
@@ -3,6 +3,7 @@ import {Core} from 'geolinker-common';
import
Neo4jStreamWriter
from
'
./neo4j-stream-writer
'
;
import
{
v1
as
neo4j
}
from
'
neo4j-driver
'
;
import
KafkaAvro
=
require
(
'
kafka-avro
'
);
import
Session
from
'
neo4j-driver/types/v1/session
'
;
/**
* To trigger this you need to set the KAFKA_AVRO_LOG_LEVEL
...
...
@@ -47,6 +48,13 @@ kafka.init().then(() => {
core
.
getNconf
().
get
(
'
neo4j:config:user
'
),
core
.
getNconf
().
get
(
'
neo4j:config:password
'
),
));
/**
* Add index and constraint to DB. If the index exists the query is ignored
* todo: not 100% sure if this is the right place to define the indexes
*/
await
driver
.
session
().
run
(
'
CREATE CONSTRAINT ON (p:Place) ASSERT p.uri IS UNIQUE
'
);
/**
* pipe the stream from kafka fo neo4j
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment