Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-1032

FTS search does not return fields

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 3.1.0
    • 3.0.1, 3.0.5, 3.0.8
    • query
    • None
    • 1
    • SDK10: SDK Metrics, SDK12: FLE Completion, TXNS, SDK14: Tracing/Otel

    Description

      FTS search query in Python 3.x does NOT return fields anymore.

      FTS search query in Python 2.x DOES.

       

      Explanations:

      In 2.x I have the following code :

      from couchbase.cluster import Cluster, PasswordAuthenticator
      from couchbase.fulltext import Params, MatchQuery, PrefixQuery
      import time
      from couchbase.bucket import Bucket
      cluster = Cluster('couchbase://localhost:8091')
      cluster.authenticate(PasswordAuthenticator('Administrator', 'password'))
      a
      # open travel-sample bucket
      cb = cluster.open_bucket('demo2')
      start = time.time()
      it = cb.search('demo2_nGram', PrefixQuery('pari'), fields = ["name"], limit=20)
      a=[]
      for hit in it:
      	print(hit)
      print('Time taken: ', time.time() - start, " seconds")
      

      The field name is actually returned. Result is OK.

      On 3.X (I tested 3.0.1 and 3.0.5, the latest one), corresponding code is:

      from couchbase.cluster import Cluster, ClusterOptions, PasswordAuthenticator
      from couchbase.exceptions import CouchbaseException
      from couchbase.search import QueryStringQuery, SearchQuery, MatchQuery, SearchOptions, PrefixQuery, HighlightStyle, SortField, SortScore, TermFacet
      import time
      cluster = Cluster('couchbase://localhost:8091', ClusterOptions(PasswordAuthenticator('Administrator', 'password')))
      start = time.time()
      result = cluster.search_query('demo2_nGram', PrefixQuery('pari'), fields=['name'], limit=20)
      a=[]
      for row in result.rows():
      	print(len(row.fields))
      	#print(row.score)
      	a.append(row.id)
      print('Time taken: ', time.time() - start, " seconds")
      print(len(result.rows()))
       

      And no fields is returned : len(row.fields) === 0
      I checked in wireshark and I CAN see the fields result in the response returned to the client BUT there is nothing in my row.fields object (empty). Result is NOK.

      Note : I “stored” the fields name and cityname (this one is not used here) in the FTS index definition (see picture in attachment)
       

      Attachments

        Issue Links

          Activity

            People

              jared.casey Jared Casey
              fabrice.leray Fabrice Leray
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty