algoliasearch-client-python icon indicating copy to clipboard operation
algoliasearch-client-python copied to clipboard

Error in json like attribute when updating to 2.5.0

Open PhilipLund opened this issue 3 years ago • 2 comments

  • Algolia Client Version: #.#.#
  • Language Version:

Description

When updating to version 2.5.0 from 2.4.0 data is missing from the searchHierachy attribute. fetching the data using curl or looking at the Algolia dashboard shows that a product has several search hierarchies but when using the algoliasearch module version 2.5.0 only the first level is returned sometimes the first and the last level.

Steps To Reproduce

Comparing the output of a single search between version 2.4.0 and 2.5.0

Example

Expected response: searchHierachy: { lvl0: [ "Husholdning" ] lvl1: [ "Rengøring" ] lvl2: [ "Rengøringsmidler" ] lvl3: [ "Toilet og bad" ] lvl4: [ "WC-rens" ] lvl5: [ "Toiletrens" ] }

Actual response: searchHierachy: { lvl0: [ "Husholdning" ] lvl5: [ "Toiletrens" ] }

PhilipLund avatar Jun 02 '21 06:06 PhilipLund

Hey @PhilipLund,

Nothing should have changed on our side, I'll dig in our past commits to make sure I didn't missed anything.

only the first level is returned sometimes the first and the last level.

Do you mean results are inconsistent? Are you using the Async client?

In the meantime, could you please:

  • Try if you still encounter this issue in the 2.6.0 version
  • Provide a code snippet to reproduce the issue (to make sure we are testing in the same conditions)

Thanks!

shortcuts avatar Oct 22 '21 12:10 shortcuts

Hey This code will only return the first and last level.

` from algoliasearch.search_client import SearchClient import pandas as pd

cols = [ "objectID", "inStock", "searchHierachy", "targetProductType", ]

client = SearchClient.create(application_id, api_key) index = client.init_index(index_name)

records = [] for record in index.browse_objects({"query": "", "attributesToRetrieve": cols}): records.append(record)

df = pd.DataFrame(records) df["lenght"] = df["searchHierachy"].apply(lambda x: len(x.keys())) cols = ["lenght", "searchHierachy"] print(df.sort_values("lenght")[cols]) ` It is inconsistent from what is displayed on the algolia dashboard. I am not using the Async client but have tried different versions (2.3.0, 2.4.0, 2.5.0, 2.6.0)

PhilipLund avatar Oct 25 '21 06:10 PhilipLund