When uploading CSV files to Algolia, it's important to ensure that numeric fields such as age or price, are treated as integers rather than strings. If there are any spaces before or after the numbers in your CSV file, Algolia may interpret these values as text, which can affect how they’re sorted and filtered.
For example, consider the following CSV:
name,age,department
James, 28,IT
Jessica,32 ,Sales
Anne,23,Engineering
In this case, the ages for James and Jessica have spaces before or after the numbers. To ensure that these fields are treated as integers, simply remove any leading or trailing spaces from the numeric values:
name,age,department
James,28,IT
Jessica,32,Sales
Anne,23,Engineering
By cleaning up these spaces before uploading, Algolia will correctly index the values as integers, ensuring accurate sorting and filtering on those fields.
In summary, when preparing your CSV file for upload, always double-check that numeric fields don’t contain any unnecessary spaces. This will help ensure your data is indexed properly and functions as expected in Algolia.