<commit_before>/*                          _       _
 *__      _____  __ ___   ___  __ _| |_ ___
 *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
 * \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
 *  \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
 *
 * Copyright © 2016 - 2019 Weaviate. All rights reserved.
 * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md
 * DESIGN & CONCEPT: <NAME> (@bobvanluijt)
 * CONTACT: <EMAIL>
 */
package network_get

import (
	"fmt"

	"github.com/creativesoftwarefdn/weaviate/database/schema/kind"
	"github.com/graphql-go/graphql"
)

func resolveKind(k kind.Kind) func(p graphql.ResolveParams) (interface{}, error) {
	kindField := kindNameInResult(k)

	return func(p graphql.ResolveParams) (interface{}, error) {
		firstLevel, ok := p.Source.(map[string]interface{})
		if !ok {
			return nil, fmt.Errorf("expected source to be map[string]interface{}, was %#v", p.Source)
		}

		secondLevel, ok := firstLevel[kindField].(map[string]interface{})
		if !ok {
			return nil, fmt.Errorf("expected source to be map[string]map[string][]interface{}, was %#v", firstLevel[kindField])
		}

		// // Log the request
		// requestsLog, ok := firstLevel["RequestsLog"].(RequestsLog)
		// if !ok {
		// 	return nil, fmt.Errorf("expected source to contain a usable RequestsLog, but was %#v", firstLevel["RequestsLog"])
		// }
		// go func() {
		// 	requestsLog.Register(telemetry.TypeGQL, telemetry.NetworkQuery)
		// }()

		return secondLevel[p.Info.FieldName], nil<commit_msg>gh-699: removed commented out code block<commit_after>/*                          _       _
 *__      _____  __ ___   ___  __ _| |_ ___
 *\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
 * \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
 *  \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
 *
 * Copyright © 2016 - 2019 Weaviate. All rights reserved.
 * LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md
 * DESIGN & CONCEPT: <NAME> (@bobvanluijt)
 * CONTACT: <EMAIL>
 */
package network_get

import (
	"fmt"

	"github.com/creativesoftwarefdn/weaviate/database/schema/kind"
	"github.com/graphql-go/graphql"
)

func resolveKind(k kind.Kind) func(p graphql.ResolveParams) (interface{}, error) {
	kindField := kindNameInResult(k)

	return func(p graphql.ResolveParams) (interface{}, error) {
		firstLevel, ok := p.Source.(map[string]interface{})
		if !ok {
			return nil, fmt.Errorf("expected source to be map[string]interface{}, was %#v", p.Source)
		}

		secondLevel, ok := firstLevel[kindField].(map[string]interface{})
		if !ok {
			return nil, fmt.Errorf("expected source to be map[string]map[string][]interface{}, was %#v", firstLevel[kindField])
		}

		return secondLevel[p.Info.FieldName], nil
{'fraction_non_alphanumeric': 0.17556128082443873, 'fraction_numerical': 0.006993006993006993, 'mean_word_length': 3.081081081081081, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '6631227', 'n_tokens_mistral': 1028, 'n_tokens_neox': 968, 'n_words': 175}