typesense-rails 1.0.0.rc1 → 1.0.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +1 -3
- data/README.md +37 -2
- data/lib/typesense/version.rb +1 -1
- data/lib/typesense-rails.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9464b9842435b27a106f49cb2f08c3620a3a8a8d6000dca04b3f6160b9fada52
|
4
|
+
data.tar.gz: d45820ebe01b8399461748128fc9874b7e4066a1c362f7e157e9ee9fb43fb18f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 553b43dedaf3e7c5930acc42df665eb79c234fc92c11c95d7defb021a6a1e50ae7b3d8682a227f47a379628f7b27a9ef17330eb1d11f0bc2c2b99c9a7a0a5699
|
7
|
+
data.tar.gz: e8a09d8358cdf1d4774e0c75a670e2bc7a2af2ad2484c5795bf28bb3740afe9065bd56839bed46356f794146ae6f5595274b9a6e66d00698f1cb91a3d2b4896e
|
data/Gemfile
CHANGED
@@ -21,7 +21,6 @@ group :test do
|
|
21
21
|
gem 'jdbc-sqlite3', :platform => :jruby
|
22
22
|
gem 'activerecord-jdbc-adapter', :platform => :jruby
|
23
23
|
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
24
|
-
gem 'redgreen'
|
25
24
|
|
26
25
|
sequel_version = ENV['SEQUEL_VERSION'] ? "~> #{ENV['SEQUEL_VERSION']}" : '>= 4.0'
|
27
26
|
gem 'sequel', sequel_version
|
data/Gemfile.lock
CHANGED
@@ -135,7 +135,7 @@ GEM
|
|
135
135
|
date
|
136
136
|
stringio
|
137
137
|
racc (1.8.1)
|
138
|
-
rack (2.2.
|
138
|
+
rack (2.2.17)
|
139
139
|
rack-test (2.2.0)
|
140
140
|
rack (>= 1.3)
|
141
141
|
rails (6.1.7.10)
|
@@ -171,7 +171,6 @@ GEM
|
|
171
171
|
rdoc (6.14.0)
|
172
172
|
erb
|
173
173
|
psych (>= 4.0.0)
|
174
|
-
redgreen (1.2.2)
|
175
174
|
regexp_parser (2.10.0)
|
176
175
|
rspec (3.13.0)
|
177
176
|
rspec-core (~> 3.13.0)
|
@@ -248,7 +247,6 @@ DEPENDENCIES
|
|
248
247
|
rails (~> 6.1)
|
249
248
|
rake (>= 10.1.0)
|
250
249
|
rdoc
|
251
|
-
redgreen
|
252
250
|
rspec (~> 3.0)
|
253
251
|
rubocop (~> 1.19)
|
254
252
|
sequel (>= 4.0)
|
data/README.md
CHANGED
@@ -126,11 +126,29 @@ class Profile < ApplicationRecord
|
|
126
126
|
end
|
127
127
|
```
|
128
128
|
|
129
|
+
### Working with ActionText
|
130
|
+
|
131
|
+
ActionText `has_rich_text` defines an association to the ActionText::RichText model. Use `to_plain_text` on this association to get a plain text version for indexing with Typesense.
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
class Product < ApplicationRecord
|
135
|
+
include Typesense
|
136
|
+
|
137
|
+
has_rich_text :description
|
138
|
+
|
139
|
+
typesense do
|
140
|
+
attribute :description do
|
141
|
+
description.to_plain_text
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
```
|
146
|
+
|
129
147
|
### Searching
|
130
148
|
|
131
149
|
```ruby
|
132
|
-
# Basic search
|
133
|
-
results = Product.search('phone', 'name')
|
150
|
+
# Basic search of "phone" against name and description attributes
|
151
|
+
results = Product.search('phone', 'name,description')
|
134
152
|
|
135
153
|
# Search with filters and sorting
|
136
154
|
results = Product.search('phone', 'name', {
|
@@ -211,6 +229,23 @@ Typesense.configuration = {
|
|
211
229
|
}
|
212
230
|
```
|
213
231
|
|
232
|
+
### Pagination & Search in a controller with Pagy
|
233
|
+
|
234
|
+
```ruby
|
235
|
+
class ProductsController < ApplicationController
|
236
|
+
def index
|
237
|
+
# If `params[:q]` is blank, Typesense will automatically use "*" to return all documents
|
238
|
+
@pagy, @products = Product.search(params[:q], "name,description")
|
239
|
+
end
|
240
|
+
end
|
241
|
+
```
|
242
|
+
|
243
|
+
```erb
|
244
|
+
<h1>Search results for <%= params[:q] %></h1>
|
245
|
+
<%= render @products %>
|
246
|
+
<%== pagy_nav(@pagy) if @pagy.pages > 1 %>
|
247
|
+
```
|
248
|
+
|
214
249
|
## Testing
|
215
250
|
|
216
251
|
To run the test suite:
|
data/lib/typesense/version.rb
CHANGED
data/lib/typesense-rails.rb
CHANGED
@@ -365,7 +365,7 @@ module Typesense
|
|
365
365
|
if options[:enqueue]
|
366
366
|
proc = if options[:enqueue] == true
|
367
367
|
proc do |record, remove|
|
368
|
-
|
368
|
+
TypesenseJob.perform_later(record, remove ? "typesense_remove_from_index!" : "typesense_index!")
|
369
369
|
end
|
370
370
|
elsif options[:enqueue].respond_to?(:call)
|
371
371
|
options[:enqueue]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typesense-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- typesense
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|