= APOC User Guide {apoc-release}
:toc: left
:experimental:
:sectid:
:sectlinks:
:toclevels: 3
:img: https://raw.githubusercontent.com/neo4j-contrib/neo4j-apoc-procedures/{branch}/docs/img
:script: https://raw.githubusercontent.com/neo4j-contrib/neo4j-apoc-procedures/{branch}/docs/script

== Introduction

NOTE: Go here for documentation for APOC for Neo4j version link:index30.html[3.0.x] link:index31.html[3.1.x] link:index32.html[3.2.x]

=== Notices

include::../readme.adoc[tags=warnings,leveloffset=1]

NOTE: Go here for documentation for APOC for Neo4j version link:index30.html[3.0.x] link:index31.html[3.1.x] link:index32.html[3.2.x]

include::../readme.adoc[tags=intro,leveloffset=1]

include::../readme.adoc[tags=signature,leveloffset=1]

== Help and Usage

include::overview.adoc[tags=help,leveloffset=-1]

To generate the help output, apoc utilizes the built in `dbms.procedures()` and `dbms.functions()` utilities.


== Overview of APOC Procedures & Functions

[[table-all]]
[separator=¦,opts=header]
|===
include::../build/generated-documentation/documentation.csv[]
|===


// include::overview.adoc[tags=overview,leveloffset=1]

include::functions.adoc[leveloffset=+1]

== Text and Lookup Indexes

=== Index Queries

Procedures to add to and query manual indexes

NOTE: Please note that there are (case-sensitive) http://neo4j.com/docs/developer-manual/current/#cypher-schema[automatic schema indexes], for equality, non-equality, existence, range queries, starts with, ends-with and contains!

[separator=¦,opts=header,cols="1,1m,5"]
|===
include::../build/generated-documentation/apoc.index.csv[]
|===

////
[cols="1m,5"]
|===
| apoc.index.addAllNodes('index-name',{label1:['prop1',...],...}, {options}) | add all nodes to this full text index with the given fields, additionally populates a 'search' index field with all of them in one place
| apoc.index.addNode(node,['prop1',...]) | add node to an index for each label it has
| apoc.index.addNodeByLabel('Label',node,['prop1',...]) | add node to an index for the given label
| apoc.index.addNodeByName('name',node,['prop1',...]) | add node to an index for the given name
| apoc.index.addRelationship(rel,['prop1',...]) | add relationship to an index for its type
| apoc.index.addRelationshipByName('name',rel,['prop1',...]) | add relationship to an index for the given name
| apoc.index.removeNodeByName('name',node) remove node from an index for the given name
| apoc.index.removeRelationshipByName('name',rel) remove relationship from an index for the given name
|===
////

image::{img}/apoc.index.nodes-with-score.jpg[width=600]

////

[cols="1m,5"]
|===
| apoc.index.search('index-name', 'query') YIELD node, weight | search for the first 100 nodes in the given full text index matching the given lucene query returned by relevance
| apoc.index.nodes('Label','prop:value*') YIELD node, weight | lucene query on node index with the given label name
| apoc.index.relationships('TYPE','prop:value*') YIELD rel, weight | lucene query on relationship index with the given type name
| apoc.index.between(node1,'TYPE',node2,'prop:value*') YIELD rel, weight | lucene query on relationship index with the given type name bound by either or both sides (each node parameter can be null)
| apoc.index.out(node,'TYPE','prop:value*') YIELD node, weight | lucene query on relationship index with the given type name for *outgoing* relationship of the given node, *returns end-nodes*
| apoc.index.in(node,'TYPE','prop:value*') YIELD node, weight | lucene query on relationship index with the given type name for *incoming* relationship of the given node, *returns start-nodes*
|===
////

=== Index Management

////
[cols="1m,5"]
|===
| CALL apoc.index.list() YIELD type,name,config | lists all manual indexes
| CALL apoc.index.remove('name') YIELD type,name,config | removes manual indexes
| CALL apoc.index.forNodes('name',{config}) YIELD type,name,config | gets or creates manual node index
| CALL apoc.index.forRelationships('name',{config}) YIELD type,name,config | gets or creates manual relationship index
|===
////

.Add node to index example
[source,cypher]
----
match (p:Person) call apoc.index.addNode(p,["name","age"]) RETURN count(*);
// 129s for 1M People
call apoc.index.nodes('Person','name:name100*') YIELD node, weight return * limit 2
----

// include::overview.adoc[tags=fulltext]

include::manual-indexes.adoc[leveloffset=2]

include::fulltext.adoc[leveloffset=2]

== Utility Functions

include::phonetic.adoc[leveloffset=2]
include::extract.adoc[leveloffset=2]

include::ttl.adoc[leveloffset=2]

include::datetime.adoc[leveloffset=2]

include::number.adoc[leveloffset=2]

include::exact.adoc[leveloffset=2]

== Graph Algorithms

include::algo.adoc[leveloffset=2]
include::expand.adoc[leveloffset=2]
include::centrality.adoc[leveloffset=2]
include::pagerank.adoc[leveloffset=2]

== Spatial

include::spatial.adoc[leveloffset=2]

== Data Integration

include::loadjson.adoc[leveloffset=2]
include::loadjdbc.adoc[leveloffset=2]
include::gephi.adoc[leveloffset=2]
include::elasticsearch.adoc[leveloffset=2]
include::loadxml.adoc[leveloffset=2]

== Graph Refactorings

include::refactor.adoc[leveloffset=2]

== Cypher Operations

include::cypher.adoc[leveloffset=2]
include::periodic.adoc[leveloffset=2]

++++
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
    $('#table-all').DataTable();
} );
</script>
++++

== Virtual

include::create-virtual-nodes-rels.adoc[leveloffset=1]

include::virtual-graph.adoc[leveloffset=1]

== Graph Refactoring

include::graph-refactor.adoc[leveloffset=1]

== Triggers

include::trigger.adoc[leveloffset=2]

== Schema

include::schema.adoc[leveloffset=2]

== Atomic

include::atomic.adoc[leveloffset=1]

== Bolt

include::bolt.adoc[leveloffset=1]

== Appendix: Complete Overview

include::overview.adoc[tags=overview,leveloffset=1]

== Performance Tests

include::big-graph-from-cypher.adoc[leveloffset=1]

include::graphml-tests.adoc[leveloffset=1]
