def more_like(pk, source, top=5):
 index = get_source_index()
 with index.searcher() as searcher:
  docnum = searcher.document_number(pk=pk)
  if (docnum is None):
   return set()
  results = searcher.more_like(docnum, 'source', source, top)
  return set([result['pk'] for result in results])

def more_like ( pk , source , top = 5 ) : index = get_source_index ( ) with index . searcher ( ) as searcher : docnum = searcher . document_number ( pk = pk ) if ( docnum is None ) : return set ( ) results = searcher . more_like ( docnum , 'source' , source , top ) return set ( [ result [ 'pk' ] for result in results ] )
finds similar units .