コード例 #1
0
ファイル: Index.cs プロジェクト: guidmaster/ravendb
        private void AssertQueryDoesNotContainFieldsThatAreNotIndexes(string query, SortedField[] fields)
        {
            var hashSet = SimpleQueryParser.GetFields(query);

            foreach (var field in hashSet)
            {
                var f = field;
                if (f.EndsWith("_Range"))
                {
                    f = f.Substring(0, f.Length - "_Range".Length);
                }
                if (viewGenerator.ContainsField(f) == false)
                {
                    throw new ArgumentException("The field '" + f + "' is not indexed, cannot query on fields that are not indexed");
                }
            }

            if (fields == null)
            {
                return;
            }

            foreach (var field in fields)
            {
                var f = field.Field;
                if (f.EndsWith("_Range"))
                {
                    f = f.Substring(0, f.Length - "_Range".Length);
                }
                if (viewGenerator.ContainsField(f) == false)
                {
                    throw new ArgumentException("The field '" + f + "' is not indexed, cannot sort on fields that are not indexed");
                }
            }
        }
コード例 #2
0
            private void AssertQueryDoesNotContainFieldsThatAreNotIndexes()
            {
                HashSet <string> hashSet = SimpleQueryParser.GetFields(indexQuery.Query);

                foreach (string field in hashSet)
                {
                    string f = field;
                    if (f.EndsWith("_Range"))
                    {
                        f = f.Substring(0, f.Length - "_Range".Length);
                    }
                    if (parent.viewGenerator.ContainsField(f) == false)
                    {
                        throw new ArgumentException("The field '" + f + "' is not indexed, cannot query on fields that are not indexed");
                    }
                }

                if (indexQuery.SortedFields == null)
                {
                    return;
                }

                foreach (SortedField field in indexQuery.SortedFields)
                {
                    string f = field.Field;
                    if (f.EndsWith("_Range"))
                    {
                        f = f.Substring(0, f.Length - "_Range".Length);
                    }
                    if (parent.viewGenerator.ContainsField(f) == false && f != Constants.DistanceFieldName)
                    {
                        throw new ArgumentException("The field '" + f + "' is not indexed, cannot sort on fields that are not indexed");
                    }
                }
            }