Skip to content

Commit 852e11f

Browse files
committed
Fix error with meta filtering and empty res
1 parent e7f7977 commit 852e11f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pinecone/core/grpc/index_grpc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def _endpoint(self):
9494
return self._endpoint_override if self._endpoint_override \
9595
else f"{self.name}-{Config.PROJECT_NAME}.svc.{Config.ENVIRONMENT}.pinecone.io:443"
9696

97-
def \
98-
_gen_channel(self, options=None):
97+
def _gen_channel(self, options=None):
9998
target = self._endpoint()
10099
default_options = {
101100
"grpc.max_send_message_length": MAX_MSG_SIZE,
@@ -184,10 +183,11 @@ def parse_query_response(response: dict):
184183
for match in response['results']:
185184
namespace = match.get('namespace', '')
186185
m = []
187-
for item in match['matches']:
188-
sc = ScoredVector(id=item['id'], score=item.get('score', 0.0), values=item.get('values', []),
189-
metadata=item.get('metadata', {}))
190-
m.append(sc)
186+
if 'matches' in match:
187+
for item in match['matches']:
188+
sc = ScoredVector(id=item['id'], score=item.get('score', 0.0), values=item.get('values', []),
189+
metadata=item.get('metadata', {}))
190+
m.append(sc)
191191
res.append(SingleQueryResults(matches=m, namespace=namespace))
192192
return QueryResponse(results=res, _check_type=False)
193193

0 commit comments

Comments
 (0)