<commit_before># node-cypher

Node Cypher is a cypher-only http client factory for neo4j that allows you to configurably optimize for individual query speed or overall query volume/throughput. Queries should not be treated as transactional, interdependent, or referential.

## Examples

```javascript
var cypher = require('node-cypher');

cypher.createClient('http://localhost:7474',function(err,client){
  client.query("MATCH (n:Person) RETURN count(n)",{},function(err,result){
    ...
  })
})
```
By default, node-cypher will make an individual request per query and does not throttle the quantity of outgoing requests in any way. In the case that you are going to be hitting Neo4j with a high volume of
requests, you can limit the amount of concurrent outgoing requests, and optimize the number of queries run in a batch per request.

Normally, one would directly use the 'batch' or 'transactional' rest APIs in order to do this. However, these comes with some caveats. 1) You could manually bundle up your requests into a batch, or 2) iteratively hit the transactional cypher endpoint. Either way, in the context of a batch or an open transaction, you are subject to a single failed request causing the entire lot to be rolled back.

node-cypher allows you to limit the number of outgoing requests and queue up pending queries against a pool of concurrent batch transactions. Meanwhile, if a batch fails, it intelligently reorders and retries uncommitted (but unproblematic) components of the batch in order to guarantee that each query that can be committed successfully, will be committed. Moreover, every failing component of the batch will be handled appropriately with its associated exception.

In the following example, a barrage of incoming requests will be distributed among a pool of ten concurrent batch operations, each submitting a maximum of 100 queries per batch.

```javascript
var connOpts = {
  host: 'http://localhost:7474', 
  base: '/db/data'
};
var clientOpts = {<commit_msg>grammar<commit_after># node-cypher

Node Cypher is a cypher-only http client factory for neo4j that allows you to configurably optimize for individual query speed or overall query volume/throughput. Queries should not be treated as transactional, interdependent, or referential.

## Examples

```javascript
var cypher = require('node-cypher');

cypher.createClient('http://localhost:7474',function(err,client){
  client.query("MATCH (n:Person) RETURN count(n)",{},function(err,result){
    ...
  })
})
```
By default, node-cypher will make an individual request per query and does not throttle the quantity of outgoing requests in any way. In the case that you are going to be hitting Neo4j with a high volume of
requests, you can limit the amount of concurrent outgoing requests, and optimize the number of queries run in a batch per request.

Normally, one would directly use the 'batch' or 'transactional' rest APIs in order to do this. However, these come with some caveats. 1) You could manually bundle up your requests into a batch, or 2) iteratively hit the transactional cypher endpoint. Either way, in the context of a batch or an open transaction, you are subject to a single failed request causing the entire lot to be rolled back.

node-cypher allows you to limit the number of outgoing requests and queue up pending queries against a pool of concurrent batch transactions. Meanwhile, if a batch fails, it intelligently reorders and retries uncommitted (but unproblematic) components of the batch in order to guarantee that each query that can be committed successfully, will be committed. Moreover, every failing component of the batch will be handled appropriately with its associated exception.

In the following example, a barrage of incoming requests will be distributed among a pool of ten concurrent batch operations, each submitting a maximum of 100 queries per batch.

```javascript
var connOpts = {
  host: 'http://localhost:7474', 
  base: '/db/data'
};
var clientOpts = {
{'fraction_non_alphanumeric': 0.0595446584938704, 'fraction_numerical': 0.007505629221916437, 'mean_word_length': 4.836496350364963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7497163', 'n_tokens_mistral': 1024, 'n_tokens_neox': 947, 'n_words': 564}