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"); } } }
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"); } } }