Skip to content

not a super urgent issue - typesense-rails does not appear to work well with pagy 43.0.0.rc #15

@williamhancharek

Description

@williamhancharek

Hello,

Recently I tried upgrading my pagy gem to 43.0.0.rc. The previous version was 9.4.0.
see here for the upgrade to 43.0.0.rc: https://ddnexus.github.io/pagy-pre/

I was able to recreate this error in a vanilla rails app using pagy and typesense-rails

I ran the following commands:

typesensetestapp(dev):002> Book.reindex!
ETHON: performed EASY effective_url=http://localhost:8108/collections/Book response_code=200 return_code=ok total_time=0.014173
  Book Load (9.2ms)  SELECT "books".* FROM "books" ORDER BY "books"."id" ASC LIMIT 250 /*application='Typesensetestapp'*/
ETHON: performed EASY effective_url=http://localhost:8108/collections/Book/documents/import?action=upsert response_code=200 return_code=ok total_time=0.02074
=> "{\"success\":true}"
typesensetestapp(dev):003> Book.search('asdf', 'title,description')
ETHON: performed EASY effective_url=http://localhost:8108/collections/Book response_code=200 return_code=ok total_time=0.006197
ETHON: performed EASY effective_url=http://localhost:8108/collections/Book/documents/search?page=1&q=asdf&query_by=title%2Cdescription response_code=200 return_code=ok total_time=0.016932
  Book Load (0.2ms)  SELECT "books".* FROM "books" WHERE "books"."id" = 1 /*application='Typesensetestapp'*/
(typesensetestapp):3:in '<main>': wrong number of arguments (given 1, expected 0) (ArgumentError)

                 ::Pagy.new(**vars)
                            ^^^^^^

My config/initializers/typsense.rb is:

Typesense.configuration = {
  nodes: [{
    host: ENV.fetch("TYPESENSE_HOST", "localhost"),     # For Typesense Cloud use xxx.a1.typesense.net
    port: ENV.fetch("TYPESENSE_PORT", "8108"),         # For Typesense Cloud use 443
    protocol: ENV.fetch("TYPESENSE_PROTOCOL", "http")     # For Typesense Cloud use https
  }],
  api_key: ENV.fetch("TYPESENSE_API_KEY", "xyz"),
  connection_timeout_seconds: 2,
  log_level: :info,        # Messages below this level will be silenced. One of (:debug, :info, :warn, :error, :fatal)
  pagination_backend: :pagy
}

my books class is

class Book < ApplicationRecord
  include Typesense

  typesense enqueue: true do
    attributes :title, :description
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions