Skip to content

Commit

Permalink
Expand description truncation to 40 words
Browse files Browse the repository at this point in the history
The existing search uses characters which isn't ideal, so its behaviour
isn't 100% replicable. 30 words turns out to be a bit too short for some
high-profile page descriptions, so bump the limit slighty.
  • Loading branch information
csutter committed Feb 6, 2024
1 parent e1aa4a0 commit 558674a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/result.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Represents an individual result as expected by Finder Frontend
class Result
MAX_DESCRIPTION_WORDS = 30
MAX_DESCRIPTION_WORDS = 40

include ActiveModel::Model

Expand Down
2 changes: 1 addition & 1 deletion spec/models/result_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
let(:stored_document) { { description: } }

it "truncates the description" do
buffalos = ("buffalo " * 30).strip
buffalos = ("buffalo " * 40).strip
expect(result.description_with_highlighting).to eq("#{buffalos}...")
end
end
Expand Down

0 comments on commit 558674a

Please sign in to comment.