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

[core] configurable full-text search with Bleve + search API endpoint #116

Merged
merged 15 commits into from
Apr 12, 2017

Conversation

nilslice
Copy link
Contributor

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, called Searchable contains two methods: IndexContent() bool and SearchMapping() (*mapping.IndexMapping, error). SearchMapping has a default implementation on item.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 the IndexContent and return true 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 and item.Omittable are both applied to the search endpoint. item.Pushable is applied only to the first matched result.

@nilslice nilslice merged commit 3c277a7 into master Apr 12, 2017
@nilslice nilslice changed the title [core] Configurable full-text search with Bleve + search API endpoint [core] configurable full-text search with Bleve + search API endpoint Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant