Exists returns true when a document with id already exists in the store.
(id string)
| 113 | |
| 114 | // Exists returns true when a document with id already exists in the store. |
| 115 | func (s *Store) Exists(id string) (bool, error) { |
| 116 | res, err := s.es.Exists(s.indexName, id) |
| 117 | if err != nil { |
| 118 | return false, err |
| 119 | } |
| 120 | switch res.StatusCode { |
| 121 | case 200: |
| 122 | return true, nil |
| 123 | case 404: |
| 124 | return false, nil |
| 125 | default: |
| 126 | return false, fmt.Errorf("[%s]", res.Status()) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // Search returns results matching a query, paginated by after. |
| 131 | func (s *Store) Search(query string, after ...string) (*SearchResults, error) { |
no test coverage detected