Query with integer or numeric value returns no results

Hi I have a set of records that look something like this:

{
    id: 256,
    name: "Book",
    genre: "comedy",
    price: 25
}

if my query is “Book” i get result, if my query is “comedy” I get results but if my query is 256 or 25 no results returned. Is there a parameter that I am misisng? Or how can I search for numerical value?

Hello @andrius

If you want to search into these fields you need to flag them as searchable attributes, but for a price for instance, this is not a good practice.

Instead, you should use a numeric refinement to filter your results by a range of price: https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/

What library are you using to query Algolia on your application?

Cheers, Maxime.

How can I flag them as searchable?

@iam4x How do you flag them? I can’t seem to find that in documentation.

@andrius

In your dashboard, select the index then tab Ranking you’ll have the first bloc “Searchable attributes”. Click on the button “ADD A SEARCHABLE ATTRIBUTE” and you’re set :wink:

1 Like

Thank you @pierre.aurele.martin thats what I was looking for.