The query builder matcher is a library that allows users to match a document to a Filter.
Filters can be constructed using the FilterFactory methods to create Filter<string> objects.
The following Filters can be created:
Equals(fieldName, bool|long|string)match value of Field exactlyNotEquals(fieldName, bool|long|string)match if value is not equal to Field valueIn(fieldName, long[]|IEnumerable<string>)match Field value to any of the listed valuesContains(fieldName, string)match if the Field value contains a substring specified by the search termStartsWith(fieldName, string)match if the Field value starts with the string specified by the search termBetween(fieldName, long, long)match if the Field value contains a value between startValue and endValue inclusive.LessThan(fieldName, long|string)match if Field value is less than specified valueLessThanOrEquals(fieldName, long|string)match if Field value is less than or equal to specified valueGreaterThan(fieldName, long|string)match if Field value is greater than specified valueGreaterThanOrEquals(fieldName, long|string)match if Field value is greater than or equal to specified valueExists(fieldName)match if the specified Field exists (even if it contains no value)Empty(fieldName)match if the specified Field does not exist or contains no valueOr(IEnumerable<Filter>)match any of the specified FiltersAnd(IEnumerable<Filter>)match all of the specified FiltersNot(Filter<string>)match if the specified Field does not match the specified Filter
To create a filter on CONTENT_PRIMARY containing the text address
Filter<string> filter = FilterFactory.Contains("CONTENT_PRIMARY", "address");
To create a filter on FILESIZE greater than 10
Filter<string> filter = FilterFactory.GreaterThan("FILESIZE", 10);
To match a document to a filter, first create a filter, and then invoke the filter.Map() method to map from Filter<string>
to Filter<IMatcherFieldSpec>, and then use the filter.IsMatch() method.
Filter<string> filter = FilterFactory.Contains("CONTENT_PRIMARY", "address");
var remappedFilter = filter.Map(x => new SchemaFieldAdapter(x));
remappedFilter.IsMatch(document);