'Feed a doctree to the index.'

def feed(self, docname, filename, title, doctree):

    self._titles[docname] = title
    self._filenames[docname] = filename
    visitor = WordCollector(doctree, self.lang)
    doctree.walk(visitor)
    def stem(word):
        try:
            return self._stem_cache[word]
        except KeyError:
            self._stem_cache[word] = self.lang.stem(word).lower()
            return self._stem_cache[word]
    _filter = self.lang.word_filter
    for word in visitor.found_title_words:
        stemmed_word = stem(word)
        if _filter(stemmed_word):
            self._title_mapping.setdefault(stemmed_word, set()).add(docname)
        elif _filter(word):
            self._title_mapping.setdefault(word, set()).add(docname)
    for word in visitor.found_words:
        stemmed_word = stem(word)
        if ((not _filter(stemmed_word)) and _filter(word)):
            stemmed_word = word
        already_indexed = (docname in self._title_mapping.get(stemmed_word, set()))
        if (_filter(stemmed_word) and (not already_indexed)):
            self._mapping.setdefault(stemmed_word, set()).add(docname)
