initial support for non-field queries

With this change, we can get slightly closer to letting plugins extend the
query syntax with queries that don't pertain to a specific field. This will
likely need some more tweaking in the future, but it should allow for
some very interesting things.
This commit is contained in:
Adrian Sampson 2013-03-14 10:20:31 -07:00
parent 79c79bfcc3
commit d0e9e3db1e

View file

@ -768,9 +768,14 @@ def construct_query_part(query_part, default_fields, all_keys):
if os.sep in pattern and 'path' in all_keys:
# This looks like a path.
return PathQuery(pattern)
else:
# Match any field.
elif issubclass(query_class, FieldQuery):
# The query type matches a specific field, but none was
# specified. So we use a version of the query that matches
# any field.
return AnyFieldQuery(pattern, default_fields, query_class)
else:
# Other query type.
return query_class(pattern)
# A boolean field.
elif key.lower() == 'comp':