From 7cecddbf49876b43ab63f90f80bf665723da5d10 Mon Sep 17 00:00:00 2001 From: Tim Burks Date: Thu, 20 Apr 2023 13:49:24 -0700 Subject: [PATCH] Bleve server (#186) --- cmd/registry-experimental/cmd/bleve/README.md | 35 +++++ cmd/registry-experimental/cmd/bleve/bleve.go | 1 + .../cmd/bleve/bleve_test.go | 102 +++++++++++++- cmd/registry-experimental/cmd/bleve/index.go | 126 ++++++++++++++---- cmd/registry-experimental/cmd/bleve/serve.go | 103 ++++++++++++++ go.mod | 28 +++- go.sum | 57 ++++++-- 7 files changed, 410 insertions(+), 42 deletions(-) create mode 100644 cmd/registry-experimental/cmd/bleve/serve.go diff --git a/cmd/registry-experimental/cmd/bleve/README.md b/cmd/registry-experimental/cmd/bleve/README.md index 016cfb4a..07e478d1 100644 --- a/cmd/registry-experimental/cmd/bleve/README.md +++ b/cmd/registry-experimental/cmd/bleve/README.md @@ -4,6 +4,9 @@ This directory contains an experimental search implementation built with https://blevesearch.com. Specs are indexed as full-text blobs and queried with the Bleve default queries. +Note that all calls below require that `registry-experimental` be configured to +use a `registry-server` instance. + Index specs with the following, where PATTERN should match one or more specs: ``` @@ -18,3 +21,35 @@ Search the index with the following: ``` registry-experimental bleve search QUERY ``` + +Indexing and search are also available with a simple REST API that is provided +by `bleve serve`. + +First run `registry-experimental bleve serve`. While it is running, +specs can be indexed and searched as follows: + +Specs can be indexed by posting JSON to the `/index` endpoint: + +``` +curl http://localhost:8888/index \ + -X POST \ + -H "Content-Type: application/json" \ + -d @- \ + <