/// <summary>
        /// Get ranked nodes from Neo4j graph database using a templated cypher query that queries an index using a supplied valid lucene query.
        /// Each node in the index has a weight rating by specifying a relationship name which is used to determine the
        /// distinct number of incoming links to each node in your query with that relationship name.
        /// You must specify the valid property name that is to be used as the label for the autocomplete search.
        /// For example, if you are querying a database of books and wanted to list the names of books in the
        /// autocomplete search, then the label property would be "Title" where each book node b has b.Title as the book name.
        /// </summary>
        /// <param name="index">The case sensitive Neo4j node index name that you want to query.</param>
        /// <param name="luceneQuery">The valid lucene query that you want to use to query the supplied index.</param>
        /// <param name="relationshipLabel">
        /// The relationship name that will be used to determine the number of incoming links to each node you are querying for.
        /// Leave blank if you want to query all incoming links regardless of relationship type.</param>
        /// <param name="labelPropertyName">The label property name for each of your Neo4j nodes. See method summary for details.</param>
        /// <param name="skip">Skip a number of a nodes, ordered by the Neo4j assigned node id of each node you are querying for. Use this for processing batches on large graph queries.</param>
        /// <param name="limit">Limit the number of results you would like returned. Use this in combination with the skip property to process batches on large graph queries.</param>
        /// <returns>Returns a list of nodes that implements IGraphNode interface, having a label and size property for ranking result order.</returns>
        public static List <IGraphNode> GetRankedNodesForQuery(string index, string luceneQuery, string relationshipLabel, string labelPropertyName, int skip, int limit)
        {
            var sb = new StringBuilder();

            sb.AppendLine("START node=node:{0}(\"{1}\")");
            sb.AppendLine("WITH node");
            sb.AppendLine("SKIP {2}");
            sb.AppendLine("LIMIT {3}");
            sb.AppendLine("WITH node");
            sb.AppendLine("MATCH n-[{4}]->node");
            sb.AppendLine("WITH node, count(distinct n) as size");
            sb.AppendLine("RETURN node.{5}? as label, size");
            sb.AppendLine("ORDER BY id(node)");
            sb.AppendLine("LIMIT {3}");

            string commandQuery = sb.ToString();

            commandQuery = string.Format(commandQuery, index, luceneQuery, skip, limit, !string.IsNullOrEmpty(relationshipLabel) ? string.Format(":{0}", relationshipLabel) : string.Empty, labelPropertyName);

            GraphClient graphClient = GetNeo4jGraphClient();

            var cypher = new CypherFluentQueryCreator(graphClient, new CypherQueryCreator(commandQuery), new Uri(Configuration.GetDatabaseUri()));

            var resulttask       = cypher.ExecuteGetCypherResults <GraphNode>();
            var graphNodeResults = resulttask.Result.ToList().Select(gn => (IGraphNode)gn).ToList();

            return(graphNodeResults);
        }
        /// <summary>
        /// Get ranked nodes from Neo4j graph database using a templated cypher query that queries an index using a supplied valid lucene query. 
        /// Each node in the index has a weight rating by specifying a relationship name which is used to determine the 
        /// distinct number of incoming links to each node in your query with that relationship name. 
        /// You must specify the valid property name that is to be used as the label for the autocomplete search. 
        /// For example, if you are querying a database of books and wanted to list the names of books in the 
        /// autocomplete search, then the label property would be "Title" where each book node b has b.Title as the book name.
        /// </summary>
        /// <param name="index">The case sensitive Neo4j node index name that you want to query.</param>
        /// <param name="luceneQuery">The valid lucene query that you want to use to query the supplied index.</param>
        /// <param name="relationshipLabel">
        /// The relationship name that will be used to determine the number of incoming links to each node you are querying for. 
        /// Leave blank if you want to query all incoming links regardless of relationship type.</param>
        /// <param name="labelPropertyName">The label property name for each of your Neo4j nodes. See method summary for details.</param>
        /// <param name="skip">Skip a number of a nodes, ordered by the Neo4j assigned node id of each node you are querying for. Use this for processing batches on large graph queries.</param>
        /// <param name="limit">Limit the number of results you would like returned. Use this in combination with the skip property to process batches on large graph queries.</param>
        /// <returns>Returns a list of nodes that implements IGraphNode interface, having a label and size property for ranking result order.</returns>
        public static List<IGraphNode> GetRankedNodesForQuery(string index, string luceneQuery, string relationshipLabel, string labelPropertyName, int skip, int limit)
        {
            var sb = new StringBuilder();
            sb.AppendLine("START node=node:{0}(\"{1}\")");
            sb.AppendLine("WITH node");
            sb.AppendLine("SKIP {2}");
            sb.AppendLine("LIMIT {3}");
            sb.AppendLine("WITH node");
            sb.AppendLine("MATCH n-[{4}]->node");
            sb.AppendLine("WITH node, count(distinct n) as size");
            sb.AppendLine("RETURN node.{5}? as label, size");
            sb.AppendLine("ORDER BY id(node)");
            sb.AppendLine("LIMIT {3}");

            string commandQuery = sb.ToString();

            commandQuery = string.Format(commandQuery, index, luceneQuery, skip, limit, !string.IsNullOrEmpty(relationshipLabel) ? string.Format(":{0}", relationshipLabel) : string.Empty, labelPropertyName);

            GraphClient graphClient = GetNeo4jGraphClient();

            var cypher = new CypherFluentQueryCreator(graphClient, new CypherQueryCreator(commandQuery), new Uri(Configuration.GetDatabaseUri()));

            var resulttask = cypher.ExecuteGetCypherResults<GraphNode>();
            var graphNodeResults = resulttask.Result.ToList().Select(gn => (IGraphNode)gn).ToList();
            return graphNodeResults;
        }