All versions of this manual
X
 

Search index: Neo4j

The neo4jSearch connector is a solution for full-text search with Neo4j.

Neo4j search integration

Linkurious can use the builtin search indices managed by Neo4j itself. You can either use the Web user-interface or edit the configuration file located at linkurious/data/config/production.json to set the index.vendor property to the value neo4jSearch.

Configuration

To edit the Neo4j data-source configuration, you can either use the Web user-interface or edit the configuration file located at linkurious/data/config/production.json.

Example configuration:

{
  "dataSources": [
    {
      "graphdb": {
        "vendor": "neo4j",
        "url": "http://127.0.0.1:7474/",
        "user": "myNeo4jUser",
        "password": "nyNeo4jPassword"
      },
      "index": {
        "vendor": "neo4jSearch",
        "batchSize": 4000000,
        "numberOfThreads": 32,
        "categoriesToIndex": ["Person", "Company"],
        "edgeTypesToIndex": ["Works for"]
      }
    }
  ]
}

Supported index options with Neo4jSearch:

  • batchSize (optional): Number of nodes to index at once
  • numberOfThreads (optional): Number of concurrent requests during indexation
  • initialization (optional): Whether to perform the actual indexation on "start indexation" or just refresh the schema
  • categoriesToIndex (optional): List of node categories to index, all by default
  • edgeTypesToIndex (optional): List of edge types to index, all by default if edge indexation is enabled

Setting batchSize and numberOfThreads to higher values will decrease the required time to index the whole dataset. Suggested values for the batch size are 10000000 (default value) and multiples of it. Regarding the number of threads, the suggested value is the number of cores of the machine where Neo4j is installed.

Configure Neo4j to create a search index

  1. Edit the Neo4 configuration at neo4j/conf/neo4j.conf and add the following lines at the beginning of the file:
dbms.auto_index.nodes.enabled=true
# node properties that will be searchable (SET YOUR OWN) 
dbms.auto_index.nodes.keys=name,description,firstName,lastName,email,content
 
# Add the following lines if you want to index relationships as well 
dbms.auto_index.relationships.enabled=true
# relationship properties that will be searchable (SET YOUR OWN) 
dbms.auto_index.relationships.keys=description,content
  1. Restart Neo4j

If you came upon "The index can't be overwritten to be lower case"

It means that Neo4j already has a node_auto_index index with a different configuration. Unfortunately, Linkurious is not able to delete or replace the configuration on this index. A manual procedure on your dataset will be necessary.

Please be sure to have a backup of your data before performing the following actions.

  1. Stop Neo4j
  2. Open your Neo4j graph database folder (by default it is in your Neo4j folder, in data/databases/graph.db)
  3. Within your database folder, open your database's index folder: index/lucene
  4. Within index/lucene, delete the node folder
  5. Within index/lucene, delete the relationship folder
  6. Run the Neo4j shell (from the Neo4j folder, run ./bin/neo4j-shell --path ./data/databases/graph.db/, check that the database folder is correct)
  7. In the neo4j shell, execute these commands:
  • index --set-config node_auto_index to_lower_case true
  • index --set-config node_auto_index type fulltext
  • index --set-config relationship_auto_index to_lower_case true
  • index --set-config relationship_auto_index type fulltext
  1. Start Neo4j, you are done!