public override void Visit(IMatchQuery query) { var inferrer = new Inferrer(new ConnectionSettings(new InMemoryConnection())); Field = inferrer.Field(query.Field); Value = query.Query; }
protected override object DeserializeJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { reader.Read(); //property name var fieldName = reader.Value as string; reader.Read(); // { var jo = JObject.Load(reader); var typePropery = jo.Property("type"); IMatchQuery query = null; var r = jo.CreateReader(); switch (typePropery?.Value.Value <string>() ?? "") { case "phrase": query = FromJson.ReadAs <MatchPhraseQuery>(r, objectType, existingValue, serializer); break; case "phrase_prefix": query = FromJson.ReadAs <MatchPhrasePrefixQuery>(r, objectType, existingValue, serializer); break; default: query = FromJson.ReadAs <MatchQuery>(r, objectType, existingValue, serializer); break; } if (query == null) { return(null); } query.Field = fieldName; return(query); }
protected static void RegisterQuery(string name, Func <IMatchQuery, q.SalesOrderDetailAlias, IWhereQuery> query) { q.SalesOrderDetailAlias alias; IMatchQuery matchQuery = Blueprint41.Transaction.CompiledQuery.Match(q.Node.SalesOrderDetail.Alias(out alias)); IWhereQuery partial = query.Invoke(matchQuery, alias); ICompiled compiled = partial.Return(alias).Compile(); RegisterQuery(name, compiled); }
public MatchService(IPlayerService playerService, IMatchQuery matchQuery, IMatchGoalService matchGoalService, IMatchEventService matchEventService, IPlayerStatsService playerStatsService, INewsService newsService, ITeamService teamService) { _matchGoalService = matchGoalService; _playerService = playerService; _matchQuery = matchQuery; _playerStatsService = playerStatsService; _matchEventService = matchEventService; _newsService = newsService; _teamService = teamService; }
public virtual void Visit(IMatchQuery query) { Write("match", query.Field); }
#pragma warning restore 618 public virtual void Visit(IMatchQuery query) { }
internal static bool IsConditionless(IMatchQuery q) => q.Field.IsConditionless() || q.Query.IsNullOrEmpty();
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var j = JObject.Load(reader); if (!j.HasValues) { return(null); } var firstProp = j.Properties().FirstOrDefault(); if (firstProp == null) { return(null); } var field = firstProp.Name; var jo = firstProp.Value.Value <JObject>(); if (jo == null) { return(null); } JToken v = null; string type = null; if (jo.TryGetValue("type", out v)) { type = v.Value <string>(); } IMatchQuery fq = null; if (type.IsNullOrEmpty()) { fq = new MatchQueryDescriptor <object>(); } else if (type == "phrase") { fq = new MatchPhraseQueryDescriptor <object>(); } else if (type == "phrase_prefix") { fq = new MatchPhrasePrefixQueryDescriptor <object>(); } else { return(null); } fq.Field = field; fq.Boost = GetPropValue <double?>(jo, "boost"); fq.Analyzer = GetPropValue <string>(jo, "analyzer"); fq.CutoffFrequency = GetPropValue <double?>(jo, "cutoff_frequency"); fq.Fuzziness = GetPropValue <double?>(jo, "fuzziness"); fq.Lenient = GetPropValue <bool?>(jo, "lenient"); fq.MaxExpansions = GetPropValue <int?>(jo, "max_expansions"); fq.PrefixLength = GetPropValue <int?>(jo, "prefix_length"); fq.Query = GetPropValue <string>(jo, "query"); fq.Slop = GetPropValue <int?>(jo, "slop"); var rewriteString = GetPropValue <string>(jo, "rewrite"); if (!rewriteString.IsNullOrEmpty()) { fq.Rewrite = rewriteString.ToEnum <RewriteMultiTerm>(); } var operatorString = GetPropValue <string>(jo, "operator"); if (!rewriteString.IsNullOrEmpty()) { fq.Operator = operatorString.ToEnum <Operator>(); } return(fq); }
public virtual void Visit(IMatchQuery customFiltersScore) { }
public ParticipantMatchesController(IMatchQuery matchQuery, IMapper mapper) { _matchQuery = matchQuery; _mapper = mapper; }
public override void Visit(IMatchQuery query) { MatchQuery = query; base.Visit(query); }
public virtual void Visit(IMatchQuery query) { }
public MatchesController(IMatchQuery matchQuery, IMapper mapper) { _matchQuery = matchQuery; _mapper = mapper; }