Ejemplo n.º 1
0
    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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 6
0
#pragma warning restore 618

        public virtual void Visit(IMatchQuery query)
        {
        }
Ejemplo n.º 7
0
 public virtual void Visit(IMatchQuery query)
 {
     Write("match", query.Field);
 }
Ejemplo n.º 8
0
 internal static bool IsConditionless(IMatchQuery q) => q.Field.IsConditionless() || q.Query.IsNullOrEmpty();
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 public virtual void Visit(IMatchQuery customFiltersScore)
 {
 }
 public ParticipantMatchesController(IMatchQuery matchQuery, IMapper mapper)
 {
     _matchQuery = matchQuery;
     _mapper     = mapper;
 }
Ejemplo n.º 12
0
 public override void Visit(IMatchQuery query)
 {
     MatchQuery = query;
     base.Visit(query);
 }
Ejemplo n.º 13
0
		public virtual void Visit(IMatchQuery query) { }
Ejemplo n.º 14
0
		public virtual void Visit(IMatchQuery customFiltersScore)
		{
		}
Ejemplo n.º 15
0
 public MatchesController(IMatchQuery matchQuery, IMapper mapper)
 {
     _matchQuery = matchQuery;
     _mapper     = mapper;
 }