'Find text in log file from current position
returns a tuple containing:
absolute position,
position in result buffer,
result buffer (the actual file contents)'

def search(self, text):

    key = hash(text)
    searcher = self._searchers.get(key)
    if (not searcher):
        searcher = ReverseFileSearcher(self.filename, text)
        self._searchers[key] = searcher
    position = searcher.find()
    if (position < 0):
        searcher.reset()
        return ((-1), (-1), '')
    read_before = (self.buffer_size / 2)
    offset = max((position - read_before), 0)
    bufferpos = (position if (offset == 0) else read_before)
    self.fp.seek(offset)
    return (position, bufferpos, self.read())
