<commit_before>package organisations

import (
	"encoding/json"
	"fmt"
	"github.com/Financial-Times/neo-utils-go/neoutils"
	"github.com/jmcvetta/neoism"
	"sort"
)

type service struct {
	cypherRunner neoutils.CypherRunner
	indexManager neoutils.IndexManager
}

//NewCypherOrganisationService returns a new service responsible for writing organisations in Neo4j
func NewCypherOrganisationService(cypherRunner neoutils.CypherRunner, indexManager neoutils.IndexManager) service {
	return service{cypherRunner, indexManager}
}

func (cd service) Initialise() error {
	return neoutils.EnsureConstraints(cd.indexManager, map[string]string{
		"Thing":             "uuid",
		"Concept":           "uuid",
		"Organisation":      "uuid",
		"FactsetIdentifier": "value",
		"TMEIdentifier":     "value",
		"UPPIdentifier":     "value"})
}

func setProps(props *map[string]interface{}, item *string, propName string) {<commit_msg>Ensure that there is index on Identifier value.<commit_after>package organisations

import (
	"encoding/json"
	"fmt"
	"github.com/Financial-Times/neo-utils-go/neoutils"
	"github.com/jmcvetta/neoism"
	"sort"
)

type service struct {
	cypherRunner neoutils.CypherRunner
	indexManager neoutils.IndexManager
}

//NewCypherOrganisationService returns a new service responsible for writing organisations in Neo4j
func NewCypherOrganisationService(cypherRunner neoutils.CypherRunner, indexManager neoutils.IndexManager) service {
	return service{cypherRunner, indexManager}
}

func (cd service) Initialise() error {

	err := neoutils.EnsureIndexes(cd.indexManager,  map[string]string{
		"Identifier": "value",
	})

	if err != nil {
		return err
	}

	return neoutils.EnsureConstraints(cd.indexManager, map[string]string{
		"Thing":             "uuid",
		"Concept":           "uuid",
		"Organisation":      "uuid",
		"FactsetIdentifier": "value",
		"TMEIdentifier":     "value",
		"UPPIdentifier":     "value"})
}

func setProps(props *map[string]interface{}, item *string, propName string) {
{'fraction_non_alphanumeric': 0.11405702851425713, 'fraction_numerical': 0.0010005002501250625, 'mean_word_length': 4.9171597633136095, 'pattern_counts': {'":': 13, '<': 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': '6578850', 'n_tokens_mistral': 669, 'n_tokens_neox': 643, 'n_words': 141}