(self, ixreader, phrases=True, expand=False, fieldname=None)
return termset
Returns a set of all byteterms in this query tree that exist in
        the given ixreader.

        :param ixreader: A :class:`whoosh.reading.IndexReader` object.
        :param phrases: Whether to add words found in Phrase queries.
        :param expand: If True, queries that match multiple terms
            will return all matching expansions.
        :rtype: set
Returns a set of all byteterms in this query tree that exist in
        the given ixreader.
Returns a set of all byteterms in this query tree that exist in the given ixreader .
def existing_terms(self, ixreader, phrases=True, expand=False, fieldname=None):
        """Returns a set of all byteterms in this query tree that exist in
        the given ixreader.

        :param ixreader: A :class:`whoosh.reading.IndexReader` object.
        :param phrases: Whether to add words found in Phrase queries.
        :param expand: If True, queries that match multiple terms
            will return all matching expansions.
        :rtype: set
        """

        schema = ixreader.schema
        termset = set()

        for q in self.leaves():
            if fieldname and fieldname != q.field():
                continue

            if expand:
                terms = q.expanded_terms(ixreader, phrases=phrases)
            else:
                terms = q.terms(phrases=phrases)

            for fieldname, text in terms:
                if (fieldname, text) in termset:
                    continue

                if fieldname in schema:
                    field = schema[fieldname]

                    try:
                        btext = field.to_bytes(text)
                    except ValueError:
                        continue

                    if (fieldname, btext) in ixreader:
                        termset.add((fieldname, btext))
        return termset
def existing_terms ( self , ixreader , phrases = True , expand = False , fieldname = None ) : schema = ixreader . schema termset = set ( ) for q in self . leaves ( ) : if fieldname and fieldname != q . field ( ) : continue if expand : terms = q . expanded_terms ( ixreader , phrases = phrases ) else : terms = q . terms ( phrases = phrases ) for fieldname , text in terms : if ( fieldname , text ) in termset : continue if fieldname in schema : field = schema [ fieldname ] try : btext = field . to_bytes ( text ) except ValueError : continue if ( fieldname , btext ) in ixreader : termset . add ( ( fieldname , btext ) ) return termset