Source code for strongdoc.api.search

#
# All Rights Reserved 2020
#

from typing import List

from strongdoc import client
from strongdoc import constants
from strongdoc.proto import search_pb2, strongdoc_pb2_grpc





[docs]class DocumentResult: """ A class that will hold a single document that matches the search result from the Search query. Attributes: docid: :class:`str` - The matching document ID. score: :class:`float` - The score of the matching document. """ def __init__(self, docid, score): """ Constructs a document that matches the search result :param docid: The matching document ID :type docid: `str` :param score: The score of the matching document :type score: `float` """ self.docid = docid self.score = score def __repr__(self): result = "\n".join(["{}: {}".format(key, str(value).replace('\n', '\n{}'.format(' '*(2+len(key))))) for key, value in self.__dict__.items()]) return result def __str__(self): return self.__repr__()