Users should be able to search for blog posts by title and content. In GraphQL form, the query would look like:
query {
posts(search: "Foo") {
title
}
}
Acceptance Tests
1. Searching by title
Given posts with titles "Foo" and "Bar", searching for "Foo" should only return the post titled "Foo".
2. Searching by body content
Consider the scenario with the following posts:
Post(content='Bar', title='Foo')
Post(content='Baz', title='Bang')
If the user searches for 'Bar', the first post should be returned since 'Bar' is contained in the content.
3. Search precedence
Give two posts, one with the title "Foo" and one with the content "Foo", searching for "Foo" should return the post with title "Foo" first since titles have higher search precedence.
Users should be able to search for blog posts by title and content. In GraphQL form, the query would look like:
Acceptance Tests
1. Searching by title
Given posts with titles "Foo" and "Bar", searching for "Foo" should only return the post titled "Foo".
2. Searching by body content
Consider the scenario with the following posts:
If the user searches for 'Bar', the first post should be returned since 'Bar' is contained in the content.
3. Search precedence
Give two posts, one with the title "Foo" and one with the content "Foo", searching for "Foo" should return the post with title "Foo" first since titles have higher search precedence.