Preformatted box that doesn't wrap the contents.
[python_utils.git] / logical_search.py
index ef55a2bbdcbb5baafa5c29a53fc404fcfb4701bb..2cbe0c781f4ba7889e1b3bcc05373c66a427888e 100644 (file)
@@ -1,8 +1,12 @@
 #!/usr/bin/env python3
 
+# © Copyright 2021-2022, Scott Gasch
+
 """This is a module concerned with the creation of and searching of a
 corpus of documents.  The corpus is held in memory for fast
-searching."""
+searching.
+
+"""
 
 from __future__ import annotations
 import enum
@@ -100,6 +104,8 @@ class Corpus(object):
     ...          )
     >>> c.query('author:Scott and important')
     {1}
+    >>> c.query('*')
+    {1, 2, 3}
     """
 
     def __init__(self) -> None:
@@ -207,6 +213,8 @@ class Corpus(object):
         tag1 and key:*
         """
 
+        if query == '*':
+            return set(self.documents_by_docid.keys())
         try:
             root = self._parse_query(query)
         except ParseError as e: