algolia / algoliasearch-client-python

⚡️ A fully-featured and blazing-fast Python API client to interact with Algolia.
https://www.algolia.com/doc/api-client/getting-started/install/python/?language=python
MIT License
196 stars 67 forks source link

Error in json like attribute when updating to 2.5.0 #527

Open PhilipLund opened 3 years ago

PhilipLund commented 3 years ago

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" ] }

shortcuts commented 2 years ago

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:

Thanks!

PhilipLund commented 2 years ago

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)