-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim
authored and
Tim
committed
Aug 5, 2020
1 parent
8b90389
commit 6afb9d9
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import os | ||
from py2neo import Graph | ||
from py2neo.database import ClientError | ||
queries = {} | ||
|
||
queries["textOfPapersAndPatents"] = 'CALL db.index.fulltext.createNodeIndex("textOfPapersAndPatents",["Fragment", "Abstract", "Paper", "Patent", "PatentTitle", "PatentClaim","PatentAbstract"],["title", "text"])' | ||
queries["GeneSymbolFullTextIndex"] = 'CALL db.index.fulltext.createNodeIndex("GeneSymbolFullTextIndex",["GeneSymbol"],["sid"])' | ||
queries["AuthorFullTextIndex"] = 'CALL db.index.fulltext.createNodeIndex("AuthorFullTextIndex",["Author"],["first", "middle","last"])' | ||
queries["EntityFullTextIndex"] = 'CALL db.index.fulltext.createNodeIndex("EntityFullTextIndex",["Entity"],["name"])' | ||
g = Graph(host=os.getenv("GC_NEO4J_URL", None), user=os.getenv( | ||
g = Graph(os.getenv("GC_NEO4J_URL", None), user=os.getenv( | ||
"GC_NEO4J_USER", None), password=os.getenv("GC_NEO4J_PASSWORD", None)) | ||
|
||
for name, query in queries.items(): | ||
print("Create fulltext index '{}'".format(name)) | ||
g.run(query) | ||
try: | ||
g.run(query) | ||
except ClientError as e: | ||
print("Index '{}' allready exists. Skip.".format(name)) |