Skip to content

[bug]: browse_synonyms and browse_rules helpers in Ruby don't work #5367

@kai687

Description

@kai687

Description

Not exactly sure what's the right solution for this, but I think Ruby's browse_synonyms and browse_rules helpers are currently broken, because the :page variable isn't initialized.

If I add the following line to the client code of browse_synonyms, it seems to work as expected:

search_synonyms_params[:page] ||= 0

Don't know if I'm overlooking something though, hence I wanted to file this issue first.

Language

Ruby

Client

Search

Steps to reproduce

I tested the following code:

# frozen_string_literal: true

require "algolia"

app_id = "..."
api_key = "..."
index_name = "..."

client = Algolia::SearchClient.create(app_id, api_key)

synonyms = client.browse_synonyms(index_name)

puts synonyms.to_json

Relevant log output

/opt/homebrew/lib/ruby/gems/3.4.0/gems/algolia-3.25.0/lib/algolia/api/search_client.rb:3322:in 'block in Algolia::SearchClient#browse_synonyms': undefined method '+' for nil (NoMethodError)

        search_synonyms_params[:page] += 1
                                      ^
        from <internal:kernel>:168:in 'Kernel#loop'
        from /opt/homebrew/lib/ruby/gems/3.4.0/gems/algolia-3.25.0/lib/algolia/api/search_client.rb:3312:in 'Algolia::SearchClient#browse_synonyms'
        from browse_synonyms.rb:11:in '<main>'

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions