Skip to content

Add ActionText + multiple column search examples #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,29 @@ class Profile < ApplicationRecord
end
```

### Working with ActionText

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.

```ruby
class Product < ApplicationRecord
include Typesense

has_rich_text :description

typesense do
attribute :description do
description.to_plain_text
end
end
end
```

### Searching

```ruby
# Basic search
results = Product.search('phone', 'name')
# Basic search of "phone" against name and description attributes
results = Product.search('phone', 'name,description')

# Search with filters and sorting
results = Product.search('phone', 'name', {
Expand Down