#NEWLINE# def _vector_impl( self , searcher , fieldnum , weighting , exclude_docs ) : #NEWLINE# #INDENT# dr = searcher . doc_reader #NEWLINE# words = self . words #NEWLINE# wordset = frozenset ( words ) #NEWLINE# maxword = max ( wordset ) #NEWLINE# slop = self . slop #NEWLINE# aq = self . _and_query ( ) #NEWLINE# for ( docnum , score ) in aq . doc_scores ( searcher , weighting = weighting , exclude_docs = exclude_docs ) : #NEWLINE# #INDENT# positions = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( w , poslist ) in dr . vector_as ( docnum , fieldnum , 'positions' ) : #NEWLINE# #INDENT# if ( w in wordset ) : #NEWLINE# #INDENT# positions [ w ] = poslist #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( w > maxword ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# current = positions [ weighting [ 0 ] ] #NEWLINE# if ( not current ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# for w in words [ 1 : ] : #NEWLINE# #INDENT# poslist = positions [ w ] #NEWLINE# newcurrent = [ ] #NEWLINE# for pos in poslist : #NEWLINE# #INDENT# start = bisect_left ( current , ( pos - slop ) ) #NEWLINE# end = bisect_right ( current , ( pos + slop ) ) #NEWLINE# for cpos in current [ start : end ] : #NEWLINE# #INDENT# if ( abs ( ( cpos - pos ) ) <= slop ) : #NEWLINE# #INDENT# newcurrent . append ( pos ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# current = newcurrent #NEWLINE# if ( not current ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# if current : #NEWLINE# #INDENT# ( yield ( docnum , ( score * len ( current ) ) ) )