Skip to content

Commit

Permalink
Add support for the headline ingredient
Browse files Browse the repository at this point in the history
Add headline to the list of supported ingredients. It contains valuable information and should be in the search index.
  • Loading branch information
sascha-karnatz committed Oct 17, 2024
1 parent acc17d3 commit 8a19294
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/alchemy-pg_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Alchemy
mattr_accessor :searchable_ingredients
@@searchable_ingredients = {
"Alchemy::Ingredients::Text": :value,
"Alchemy::Ingredients::Headline": :value,
"Alchemy::Ingredients::Richtext": :stripped_body,
"Alchemy::Ingredients::Picture": :caption,
}
Expand Down
7 changes: 7 additions & 0 deletions spec/models/ingredient_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@
it_behaves_like "a searchable content"
end

describe Alchemy::Ingredients::Headline do
let(:ingredient) { create(:alchemy_ingredient_headline, value: "foo bar", element: element) }

it_behaves_like "it is searchable", field: :value
it_behaves_like "a searchable content"
end

describe Alchemy::Ingredients::Richtext do
let(:ingredient) { create(:alchemy_ingredient_richtext, value: "<b>foo</b> bar", element: element) }

Expand Down

0 comments on commit 8a19294

Please sign in to comment.