Skip to content
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

AO3-6537 Use standard analyzer for work title search #4786

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion app/models/search/work_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def self.mapping
},
title: {
type: "text",
analyzer: "simple"
analyzer: "standard"
},
creators: {
type: "text"
Expand Down
4 changes: 2 additions & 2 deletions features/fixtures/works.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ first:
second:
id: 2
posted: true
title: second work
title: second work (2 of 6)
word_count: 1000
title_to_sort_on: second work
language: english
Expand Down Expand Up @@ -61,4 +61,4 @@ sixth:
created_at: 2013-04-30
revised_at: 2013-04-30
expected_number_of_chapters: 2
complete: false
complete: false
14 changes: 14 additions & 0 deletions features/search/works_info.feature
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,17 @@ Feature: Search works by work info
Then the field labeled "Title" should contain "work"
And "Title" should be selected within "Sort by"
And "Ascending" should be selected within "Sort direction"

Scenario: Search by number in title
Given I have loaded the fixtures
When I am on the search works page
And I fill in "Title" with "work 2 6"
And I press "Search" within "#new_work_search"
Then I should see "You searched for: Title: work 2 6"
And I should see "1 Found"
And the 1st result should contain "second work (2 of 6)"
When I am on the search works page
And I fill in "Title" with "work 1"
And I press "Search" within "#new_work_search"
Then I should see "You searched for: Title: work 1"
And I should see "No results found"
Loading