Details
-
Bug
-
Resolution: Fixed
-
Major
-
4.0.2
-
None
-
None
-
1
-
SDK30
Description
In SDK 3.x, the Search Metrics can be fetched from the metrics property directly.
In SDK 4.x, the metrics are not available in the same way anymore.
from couchbase.cluster import Cluster, ClusterOptions
from couchbase.auth import PasswordAuthenticator
from couchbase.exceptions import CouchbaseException
import couchbase.search as searchcluster = Cluster.connect(
“couchbase://localhost”,
ClusterOptions(PasswordAuthenticator(“Administrator”, “password”)))
bucket = cluster.bucket(“travel-sample”)
collection = bucket.default_collection()try:
result = cluster.search_query(
“travel-sample-index”, search.QueryStringQuery(“swanky”))for row in result.rows():
print(“Found row: {}“.format(row))print(“Reported total rows: {}“.format(
result.metadata().metrics.total_rows))except CouchbaseException as ex:
import traceback
traceback.print_exc()
Exception
Error:'function' object has no attribute 'total_rows'
I could not figure out how to get the total_rows or other metrics in the SDK 4.x.
Observations
- metrics is being interpreted as a method instead of property.
- And the method metrics() returns None.