search

The function search(query_schema, size, function_name, collection_name) runs search queries inside a collection.

Input

  • query_schema – Specifies the document for the query schema object.

  • size – Specifies the number of results to return.

  • function_name – Specifies the scoring function to be used in the Classic Search query, as described in Step 1, Creating the Scoring Function.

  • collection_name – Specifies the Collection in which to search.

  • fields (optional) – Specifies the document fields to be returned with each result.

Example

results = hyperspace_client.search(query_schema,
                                   size=5,
                                   function_name='score_function',
                                   fields=["fieldname1", "fieldname2"],               
                                   collection_name=collection_name)

Response

A list of candidates, as shown in the example below

{ "candidates": 1, "similarity": [ { "document_id": "29", "score": 10.0, "fields": { "FirstSeenTime": 1506116398, "City": "Jakarta" } } ], "took_ms": 33.625 }

Last updated