|
2 | 2 | name: Bug Report 🐞 |
3 | 3 | about: Create a report to help us improve. |
4 | 4 | title: '' |
5 | | -labels: '' |
| 5 | +labels: ["bug"] |
6 | 6 | assignees: '' |
7 | 7 | --- |
8 | 8 |
|
9 | 9 | <!-- This is not an exhaustive model but a help. No step is mandatory. --> |
10 | 10 |
|
11 | | -**Description** |
12 | | -Description of what the bug is about. |
| 11 | +### Description |
| 12 | +<!-- Description of what the bug is about. --> |
13 | 13 |
|
14 | | -**Expected behavior** |
15 | | -What you expected to happen. |
| 14 | +### Expected behavior |
| 15 | +<!-- What you expected to happen. --> |
16 | 16 |
|
17 | | -**Current behavior** |
18 | | -What happened. |
| 17 | +### Current behavior |
| 18 | +<!-- What happened. --> |
19 | 19 |
|
20 | | -**Screenshots or Logs** |
21 | | -If applicable, add screenshots or logs to help explain your problem. |
| 20 | +### Screenshots or logs |
| 21 | +<!-- If applicable, add screenshots or logs to help explain your problem. --> |
22 | 22 |
|
23 | | -**Environment (please complete the following information):** |
24 | | -- OS: [e.g. Debian GNU/Linux] |
25 | | -- Meilisearch server version: [e.g. v.0.20.0] |
26 | | -- meilisearch-rails version: [e.g v0.1.0] |
27 | | -- Rails version: [e.g. 6.1.3.2] |
| 23 | +### Environment |
| 24 | +**Operating System** [e.g. Debian GNU/Linux] (`cat /etc/*-release | head -n1`): |
| 25 | + |
| 26 | +**Meilisearch version** (`./meilisearch --version`): |
| 27 | + |
| 28 | +**meilisearch-rails version** (`bundle info meilisearch-rails`): |
| 29 | + |
| 30 | +**rails version** (`bundle info rails`): |
| 31 | + |
| 32 | +### Reproduction script: |
| 33 | + |
| 34 | +<!-- Write a script that reproduces your issue. Feel free to get started with the example below --> |
| 35 | + |
| 36 | +<!-- |
| 37 | +```ruby |
| 38 | +require "bundler/inline" |
| 39 | +
|
| 40 | +gemfile(true) do |
| 41 | + source "https://rubygems.org" |
| 42 | + ruby '3.3.7' |
| 43 | +
|
| 44 | + gem 'minitest', '~> 5.25', '>= 5.25.4' |
| 45 | + gem 'rails', '~> 8.0', '>= 8.0.2' |
| 46 | + gem 'sqlite3', '~> 2', platform: %i[rbx ruby] |
| 47 | + gem 'jdbc-sqlite3', platform: :jruby |
| 48 | +
|
| 49 | + gem 'meilisearch-rails', ENV["MEILISEARCH_RAILS_VERSION"] || "~> 0.14.2" |
| 50 | + # If you want to test against changes that have been not released yet |
| 51 | + # gem "meilisearch-rails", github: "meilisearch/meilisearch-rails", branch: 'main' |
| 52 | +
|
| 53 | + # Use MongoDB |
| 54 | + # gem 'mongoid', '~> 9.0', '>= 9.0.6' |
| 55 | +
|
| 56 | + # Use Sequel |
| 57 | + # gem 'sequel', '~> 5.90' |
| 58 | +
|
| 59 | + # Open a debugging session with the `debugger` method |
| 60 | + # gem 'debug' |
| 61 | +end |
| 62 | +
|
| 63 | +require 'minitest/autorun' |
| 64 | +
|
| 65 | +MeiliSearch::Rails.configuration = { |
| 66 | + meilisearch_url: ENV.fetch('MEILISEARCH_HOST', 'http://127.0.0.1:7700'), |
| 67 | + meilisearch_api_key: ENV.fetch('MEILISEARCH_API_KEY', 'masterKey'), |
| 68 | + per_environment: true |
| 69 | +} |
| 70 | +
|
| 71 | +############################### |
| 72 | +# ActiveRecord database setup # |
| 73 | +############################### |
| 74 | +# require 'active_record' |
| 75 | +# |
| 76 | +# ar_db_file = Tempfile.new |
| 77 | +# ActiveRecord::Base.establish_connection( |
| 78 | +# 'adapter' => defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3', |
| 79 | +# 'database' => ar_db_file.path, |
| 80 | +# 'pool' => 5, |
| 81 | +# 'timeout' => 5000 |
| 82 | +# ) |
| 83 | +# |
| 84 | +# ActiveRecord::Schema[8.0].define do |
| 85 | +# create_table "ar_books", force: :cascade do |t| |
| 86 | +# t.string "title" |
| 87 | +# t.string "author" |
| 88 | +# t.datetime "created_at", null: false |
| 89 | +# t.datetime "updated_at", null: false |
| 90 | +# end |
| 91 | +# end |
| 92 | +# |
| 93 | +# class ArBook < ActiveRecord::Base |
| 94 | +# include MeiliSearch::Rails |
| 95 | +# |
| 96 | +# meilisearch |
| 97 | +# end |
| 98 | +
|
| 99 | +######################### |
| 100 | +# Sequel database setup # |
| 101 | +######################### |
| 102 | +# require 'sequel' |
| 103 | +# |
| 104 | +# def sequel_db |
| 105 | +# @sequel_db_file ||= Tempfile.new |
| 106 | +# @sequel_db ||= Sequel.connect(if defined?(JRUBY_VERSION) |
| 107 | +# "jdbc:sqlite:#{@sequel_db_file.path}" |
| 108 | +# else |
| 109 | +# { 'adapter' => 'sqlite', |
| 110 | +# 'database' => @sequel_db_file.path } |
| 111 | +# end) |
| 112 | +# end |
| 113 | +# |
| 114 | +# sequel_db.create_table(:sequel_books) do |
| 115 | +# primary_key :id |
| 116 | +# String :title |
| 117 | +# String :author |
| 118 | +# end |
| 119 | +# |
| 120 | +# class SequelBook < Sequel::Model(sequel_db) |
| 121 | +# plugin :active_model |
| 122 | +# include MeiliSearch::Rails |
| 123 | +# |
| 124 | +# meilisearch |
| 125 | +# end |
| 126 | +
|
| 127 | +########################## |
| 128 | +# Mongoid database setup # |
| 129 | +########################## |
| 130 | +# Mongoid.load_configuration({ |
| 131 | +# clients: { |
| 132 | +# default: { |
| 133 | +# database: "bug_report_#{SecureRandom.hex(8)}", |
| 134 | +# hosts: ['localhost:27017'], |
| 135 | +# options: { |
| 136 | +# read: { mode: :primary }, |
| 137 | +# max_pool_size: 1 |
| 138 | +# } |
| 139 | +# } |
| 140 | +# } |
| 141 | +# }) |
| 142 | +# |
| 143 | +# class MongoBook |
| 144 | +# include Mongoid::Document |
| 145 | +# include Mongoid::Timestamps |
| 146 | +# |
| 147 | +# field :title, type: String |
| 148 | +# field :price_cents, type: Integer |
| 149 | +# |
| 150 | +# include MeiliSearch::Rails |
| 151 | +# |
| 152 | +# meilisearch |
| 153 | +# end |
| 154 | +
|
| 155 | +# Run this method before searching to make sure Meilisearch is up to date |
| 156 | +def await_last_task |
| 157 | + task = MeiliSearch::Rails.client.tasks['results'].first |
| 158 | + MeiliSearch::Rails.client.wait_for_task task['uid'] |
| 159 | +end |
| 160 | +
|
| 161 | +class BugTest < Minitest::Test |
| 162 | + def test_my_bug |
| 163 | + # your code here |
| 164 | + end |
| 165 | +end |
| 166 | +``` |
| 167 | +--> |
0 commit comments