예제 #1
0
        public static MatchQuery BuildMatchQuery(Aliyun.TableStore.DataModel.Search.Query.MatchQuery query)
        {
            MatchQuery.Builder builder = MatchQuery.CreateBuilder();

            builder.SetFieldName(query.FieldName);
            builder.SetText(query.Text);
            if (query.MinimumShouldMatch != null)
            {
                builder.SetMinimumShouldMatch(query.MinimumShouldMatch.Value);
            }
            switch (query.Operator)
            {
            case Aliyun.TableStore.DataModel.Search.Query.QueryOperator.AND:
                builder.SetOperator(QueryOperator.AND);
                break;

            case Aliyun.TableStore.DataModel.Search.Query.QueryOperator.OR:
                builder.SetOperator(QueryOperator.OR);
                break;

            default:
                throw new ArgumentException("unsupported operator:" + query.Operator);
            }

            return(builder.Build());
        }