[core] configurable full-text search with Bleve + search API endpoint #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the ability to enable indexing content on a per-type basis, to be searched through the new
/api/search?type=<Type>&q=<Query String>
endpoint, as partially detailed in #51.A new interface in the
system/db
package, calledSearchable
contains two methods:IndexContent() bool
andSearchMapping() (*mapping.IndexMapping, error)
.SearchMapping
has a default implementation onitem.Item
to set up the default index mapping from Bleve. In order to tell Ponzu to manage your content in Bleve's index, all you need to do is implement theIndexContent
and returntrue
from the method.The search endpoint can take any query format supported by Bleve, as long as your underlying data types meet the requirements (dates for date range queries, numeric types for numeric range queries, etc). Also, the search endpoint will respect the various interfaces used by content types to hide or omit content from API results.
item.Hideable
anditem.Omittable
are both applied to the search endpoint.item.Pushable
is applied only to the first matched result.