Allow query for '*' that returns all docids.
authorScott Gasch <[email protected]>
Sun, 17 Apr 2022 18:15:30 +0000 (11:15 -0700)
committerScott Gasch <[email protected]>
Sun, 17 Apr 2022 18:15:30 +0000 (11:15 -0700)
logical_search.py

index b6d7479879010d6ea40ef813d03e84574ead7e55..2cbe0c781f4ba7889e1b3bcc05373c66a427888e 100644 (file)
@@ -104,6 +104,8 @@ class Corpus(object):
     ...          )
     >>> c.query('author:Scott and important')
     {1}
+    >>> c.query('*')
+    {1, 2, 3}
     """
 
     def __init__(self) -> None:
@@ -211,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: