diff -r 5a7188bf2894 -r 1ab95857d584 log_search.py --- a/log_search.py Mon Feb 09 23:49:57 2009 +0200 +++ b/log_search.py Tue Feb 10 00:04:15 2009 +0200 @@ -8,6 +8,20 @@ import log_line +class LogSearchError (Exception) : + """ + General search error + """ + + pass + +class NoResultsFound (LogSearchError) : + """ + No results found + """ + + pass + class LogSearchIndex (object) : """ An index on the logs for a group of channels. @@ -111,12 +125,16 @@ def search_cond (self, cond) : """ - Search using a raw hype.Condition + Search using a raw hype.Condition. Raises NoResultsFound if there aren't any results """ # execute search, unused 'flags' arg stays zero results = self.db.search(cond, 0) + # no results? + if not results : + raise NoResultsFound() + # iterate over the document IDs for doc_id in results : # load document, this throws an exception...