github.com/rpdict/ponzu@v0.10.1-0.20190226054626-477f29d6bf5e/docs/src/HTTP-APIs/Search.md (about)

     1  title: Full-text Search HTTP API
     2  
     3  Ponzu provides a read-only HTTP API to search the contents of your system's database. 
     4  Full-text search is made possible by the use of [Bleve](http://blevesearch.com), 
     5  which handles the indexing and querying. 
     6  
     7  ---
     8  
     9  ### Endpoints
    10  
    11  #### Search Content
    12  
    13  <kbd>GET</kbd> `/api/search?type=<Type>&q=<Query String>`
    14  
    15  !!! warning "Search must be enabled individually for each Content type"
    16      - Search is not on by default to protect your data in case it shouldn't be indexed and published via the API.
    17      - `SearchMapping()` is implemented with default mapping (ideal for 99% of use cases). 
    18      - To enable search, add a `IndexContent() bool` method to your content type and return `true` (default implementation returns false).
    19  
    20  - `<Type>` must implement [db.Searchable](/Interfaces/Search/#searchsearchable)
    21  
    22  - Search is currently limited to single `<Type>` per request
    23  
    24  - `<Query String>` documentation here: [Bleve Docs - Query String](http://www.blevesearch.com/docs/Query-String-Query/)
    25  
    26  - Search results are formatted exactly the same as standard Content API calls, so you don't need to change your client data model  
    27  
    28  - Search handler will respect other interface implementations on your content, including: 
    29      - [`item.Hideable`](https://godoc.org/github.com/rpdict/ponzu/system/item#Hideable)
    30      - [`item.Omittable`](https://godoc.org/github.com/rpdict/ponzu/system/item#Omittable) 
    31      - [`item.Pushable`](https://godoc.org/github.com/rpdict/ponzu/system/item#Pushable) _(Note: only the first search result will be pushed)_
    32  
    33  ##### Sample Response
    34  ```javascript
    35  {
    36    "data": [
    37      {
    38          "uuid": "024a5797-e064-4ee0-abe3-415cb6d3ed18",
    39          "id": 6,
    40          "slug": "item-id-024a5797-e064-4ee0-abe3-415cb6d3ed18", // customizable
    41          "timestamp": 1493926453826, // milliseconds since Unix epoch
    42          "updated": 1493926453826,
    43          // your content data...,
    44      }
    45    ]
    46  }
    47  ```