private static CypherResult ExecuteMirrorCypherQuery(string query, AlgoContext context, int[] productIds) { try { Log.Debug("ExecuteMirrorQuery", "Building query from parameters", query); string filteredQuery = BuildMirrorQuery(query, productIds); Log.Debug("ExecuteMirrorQuery", "Query built from parameters", filteredQuery); Neo4jContext client = new Neo4jContext(false); Dictionary <string, string> parameters = new Dictionary <string, string>(); foreach (RecommendationContext item in context.Context.Keys) { parameters[item.ToString()] = context.Context[item]; } string response = client.GetWithCypherQuery(filteredQuery, parameters); return(JsonConvert.DeserializeObject <CypherResult>(response)); } catch (Exception e) { Log.Error("ExecuteMirrorQuery", "Error executing query", e); throw; } }
private static CypherResult ExecuteCypherRecommendation(string query, ContentTypeDistribution distribution, AggregateFilter filters, AlgoContext context, out string requestString) { try { Log.Debug("ExecuteRecommendationQuery", "Building query from parameters", query); string filteredQuery = BuildCypherRecommendationQuery(query, filters, distribution); Log.Debug("ExecuteRecommendationQuery", "Query built from parameters", filteredQuery); Neo4jContext client = new Neo4jContext(false); Dictionary <string, string> parameters = new Dictionary <string, string>(); foreach (RecommendationContext item in context.Context.Keys) { parameters[item.ToString()] = context.Context[item]; } string response = client.GetWithCypherQuery(filteredQuery, parameters, out requestString); return(JsonConvert.DeserializeObject <CypherResult>(response)); } catch (Exception e) { Log.Error("ExecuteRecommendationQuery", "Error executing query", e); throw; } }