Skip to content
Permalink
Browse files

fix(service): add doc type to req generator

  • Loading branch information...
Larryjianfeng committed Jul 26, 2019
1 parent 80e234e commit d834f578218ee38d4984ec8243b2d77aa6bb65ba
Showing with 3 additions and 3 deletions.
  1. +3 −3 gnes/proto/__init__.py
@@ -28,7 +28,7 @@

class RequestGenerator:
@staticmethod
def index(data: List[bytes], batch_size: int = 0, start_id: int = 0, doc_type: str = 'TEXT', *args, **kwargs):
def index(data: List[bytes], batch_size: int = 0, start_id: int = 0, doc_type: int = 1, *args, **kwargs):

for pi in batch_iterator(data, batch_size):
req = gnes_pb2.Request()
@@ -42,7 +42,7 @@ def index(data: List[bytes], batch_size: int = 0, start_id: int = 0, doc_type: s
start_id += 1

@staticmethod
def train(data: List[bytes], batch_size: int = 0, start_id: int = 0, doc_type: str = 'TEXT', *args, **kwargs):
def train(data: List[bytes], batch_size: int = 0, start_id: int = 0, doc_type: int = 1, *args, **kwargs):
for pi in batch_iterator(data, batch_size):
req = gnes_pb2.Request()
req.request_id = str(start_id)
@@ -59,7 +59,7 @@ def train(data: List[bytes], batch_size: int = 0, start_id: int = 0, doc_type: s
start_id += 1

@staticmethod
def query(query: bytes, top_k: int, start_id: int = 0, doc_type: str = 'TEXT', *args, **kwargs):
def query(query: bytes, top_k: int, start_id: int = 0, doc_type: int = 1, *args, **kwargs):
if top_k <= 0:
raise ValueError('"top_k: %d" is not a valid number' % top_k)

0 comments on commit d834f57

Please sign in to comment.
You can’t perform that action at this time.