Esempio n. 1
0
        private static void SetSuggestionQueryFieldAndTerm(IRavenQueryInspector queryInspector, SuggestionQuery query)
        {
            var lastEqualityTerm = queryInspector.GetLastEqualityTerm();

            if (lastEqualityTerm.Key == null)
            {
                throw new InvalidOperationException("Could not suggest on a query that doesn't have a single equality check");
            }

            query.Field = lastEqualityTerm.Key;
            query.Term  = lastEqualityTerm.Value;
        }
Esempio n. 2
0
        private static void SetSuggestionQueryFieldAndTerm(IRavenQueryInspector queryInspector, SuggestionQuery query, bool isAsync = false)
        {
            if (string.IsNullOrEmpty(query.Field) == false && string.IsNullOrEmpty(query.Term) == false)
            {
                return;
            }

            var lastEqualityTerm = queryInspector.GetLastEqualityTerm(isAsync);

            if (lastEqualityTerm.Key == null)
            {
                throw new InvalidOperationException("Could not suggest on a query that doesn't have a single equality check");
            }

            query.Field = lastEqualityTerm.Key;
            query.Term  = lastEqualityTerm.Value;
        }