def search(self, text):
key = hash(text)<EOL>searcher = self._searchers.get(key)<EOL>if not searcher:<EOL><INDENT>searcher = ReverseFileSearcher(self.filename, text)<EOL>self._searchers[key] = searcher<EOL><DEDENT>position = searcher.find()<EOL>if position < <NUM_LIT:0>:<EOL><INDENT>searcher.reset()<EOL>return -<NUM_LIT:1>, -<NUM_LIT:1>, '<STR_LIT>'<EOL><DEDENT>read_before = self.buffer_size / <NUM_LIT:2><EOL>offset = max(position - read_before, <NUM_LIT:0>)<EOL>bufferpos = position if offset == <NUM_LIT:0> else read_before<EOL>self.fp.seek(offset)<EOL>return position, bufferpos, self.read()<EOL>
Find text in log file from current position

returns a tuple containing:
    absolute position,
    position in result buffer,
    result buffer (the actual file contents)