(self, reader, weighting=scoring.BM25F, closereader=True,
                 fromindex=None, parent=None)
:param reader: An :class:`~whoosh.reading.IndexReader` object for
            the index to search.
        :param weighting: A :class:`whoosh.scoring.Weighting` object to use to
            score found documents.
        :param closereader: Whether the underlying reader will be closed when
            the searcher is closed.
        :param fromindex: An optional reference to the index of the underlying
            reader. This is required for :meth:`Searcher.up_to_date` and
            :meth:`Searcher.refresh` to work.
:param reader: An :class:`~whoosh.reading.IndexReader` object for
            the index to search.
        :param weighting: A :class:`whoosh.scoring.Weighting` object to use to
            score found documents.
        :param closereader: Whether the underlying reader will be closed when
            the searcher is closed.
        :param fromindex: An optional reference to the index of the underlying
            reader. This is required for :meth:`Searcher.up_to_date` and
            :meth:`Searcher.refresh` to work.
: param reader : An : class : ~whoosh . reading . IndexReader object for the index to search . : param weighting : A : class : whoosh . scoring . Weighting object to use to score found documents . : param closereader : Whether the underlying reader will be closed when the searcher is closed . : param fromindex : An optional reference to the index of the underlying reader . This is required for : meth : Searcher . up_to_date and : meth : Searcher . refresh to work .
def __init__(self, reader, weighting=scoring.BM25F, closereader=True,
                 fromindex=None, parent=None):
        """
        :param reader: An :class:`~whoosh.reading.IndexReader` object for
            the index to search.
        :param weighting: A :class:`whoosh.scoring.Weighting` object to use to
            score found documents.
        :param closereader: Whether the underlying reader will be closed when
            the searcher is closed.
        :param fromindex: An optional reference to the index of the underlying
            reader. This is required for :meth:`Searcher.up_to_date` and
            :meth:`Searcher.refresh` to work.
        """

        self.ixreader = reader
        self.is_closed = False
        self._closereader = closereader
        self._ix = fromindex
        self._doccount = self.ixreader.doc_count_all()
        # Cache for PostingCategorizer objects (supports fields without columns)
        self._field_caches = {}

        if parent:
            self.parent = weakref.ref(parent)
            self.schema = parent.schema
            self._idf_cache = parent._idf_cache
            self._filter_cache = parent._filter_cache
        else:
            self.parent = None
            self.schema = self.ixreader.schema
            self._idf_cache = {}
            self._filter_cache = {}

        if type(weighting) is type:
            self.weighting = weighting()
        else:
            self.weighting = weighting

        self.leafreaders = None
        self.subsearchers = None
        if not self.ixreader.is_atomic():
            self.leafreaders = self.ixreader.leaf_readers()
            self.subsearchers = [(self._subsearcher(r), offset) for r, offset
                                 in self.leafreaders]

        # Copy attributes/methods from wrapped reader
        for name in ("stored_fields", "all_stored_fields", "has_vector",
                     "vector", "vector_as", "lexicon", "field_terms",
                     "frequency", "doc_frequency", "term_info",
                     "doc_field_length", "corrector", "iter_docs"):
            setattr(self, name, getattr(self.ixreader, name))
def __init__ ( self , reader , weighting = scoring . BM25F , closereader = True , fromindex = None , parent = None ) : self . ixreader = reader self . is_closed = False self . _closereader = closereader self . _ix = fromindex self . _doccount = self . ixreader . doc_count_all ( ) # Cache for PostingCategorizer objects (supports fields without columns) self . _field_caches = { } if parent : self . parent = weakref . ref ( parent ) self . schema = parent . schema self . _idf_cache = parent . _idf_cache self . _filter_cache = parent . _filter_cache else : self . parent = None self . schema = self . ixreader . schema self . _idf_cache = { } self . _filter_cache = { } if type ( weighting ) is type : self . weighting = weighting ( ) else : self . weighting = weighting self . leafreaders = None self . subsearchers = None if not self . ixreader . is_atomic ( ) : self . leafreaders = self . ixreader . leaf_readers ( ) self . subsearchers = [ ( self . _subsearcher ( r ) , offset ) for r , offset in self . leafreaders ] # Copy attributes/methods from wrapped reader for name in ( "stored_fields" , "all_stored_fields" , "has_vector" , "vector" , "vector_as" , "lexicon" , "field_terms" , "frequency" , "doc_frequency" , "term_info" , "doc_field_length" , "corrector" , "iter_docs" ) : setattr ( self , name , getattr ( self . ixreader , name ) )