Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-S-2018 committed Feb 5, 2024
1 parent c36feba commit 3aec930
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 44 deletions.
73 changes: 57 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,67 @@

Сlient for Manticore Search.

❗ WARNING: this is a development version of the client. The latest release's readme is https://github.com/manticoresoftware/manticoresearch-go/tree/v1.0.0

## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.

- API version: 3.3.1
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
For more information, please visit [https://manticoresearch.com/contact-us/](https://manticoresearch.com/contact-us/)
## Requiments

| Manticore Search | manticoresearch-go | Go |
| ----------------- | ---------------------------- | ------------- |
| >= 6.2.12 | v1.0.0 | >= 17.0 |

## Installation

Install the following dependencies:
```shell

go get github.com/manticoresoftware/manticoresearch-go

```sh
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
```

Put the package under your project folder and add the following in import:
## Getting Started

```go
import openapi "github.com/manticoresoftware/manticoresearch-go"
```

To use a proxy, set the environment variable `HTTP_PROXY`:
package main

import (
"context"
"fmt"
"os"
"strings"
openapiclient "github.com/manticoresoftware/manticoresearch-go"
)

func main() {

// Initialize ApiClient
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)

// Add documents to an index
docs := []string {
"{\"insert\": {\"index\" : \"test\", \"id\" : 1, \"doc\" : {\"title\" : \"Title 1\"}}}",
"{\"insert\": {\"index\" : \"test\", \"id\" : 2, \"doc\" : {\"title\" : \"Title 2\"}}}"
}
apiClient.IndexAPI.Bulk(context.Background()).Body(strings.Join(docs[:], "\n")).Execute()

// response from `Search`: SearchRequest
searchRequest := *openapiclient.NewSearchRequest("test")

// Perform a search
query := map[string]interface{} {"query_string": "Title"}
searchRequest.SetQuery(query)
resp, r, err := apiClient.SearchAPI.Search(context.Background()).SearchRequest(searchRequest).Execute()

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SearchAPI.Search``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `Search`: SearchResponse
fmt.Fprintf(os.Stdout, "Response from `SearchAPI.Search`: %v\n", resp)
}


```go
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

## Configuration of Server URL
Expand Down Expand Up @@ -73,6 +106,14 @@ ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVari
})
```

### Using proxy

To use a proxy, set the environment variable `HTTP_PROXY`:

```go
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

## Documentation for API Endpoints

All URIs are relative to *http://127.0.0.1:9308*
Expand Down
57 changes: 29 additions & 28 deletions docs/SearchAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ All URIs are relative to *http://127.0.0.1:9308*

Method | HTTP request | Description
------------- | ------------- | -------------
[**Percolate**](SearchAPI.md#Percolate) | **Post** /pq/{index}/search | Perform reverse search on a percolate index
[**Search**](SearchAPI.md#Search) | **Post** /search | Performs a search on an index
[**Percolate**](SearchAPI.md#Percolate) | **Post** /pq/{index}/search | Perform reverse search on a percolate index


## Search

## Percolate

> SearchResponse Percolate(ctx, index).PercolateRequest(percolateRequest).Execute()
> SearchResponse Search(ctx).SearchRequest(searchRequest).Execute()
Perform reverse search on a percolate index
Performs a search on an index



Expand All @@ -30,38 +29,34 @@ import (
)

func main() {
index := "index_example" // string | Name of the percolate index
percolateRequest := *openapiclient.NewPercolateRequest(*openapiclient.NewPercolateRequestQuery(map[string]interface{}(123))) // PercolateRequest |
searchRequest := *openapiclient.NewSearchRequest("test") // SearchRequest |
query := map[string]interface{} {"query_string": "Title"}
searchRequest.SetQuery(query);

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.SearchAPI.Percolate(context.Background(), index).PercolateRequest(percolateRequest).Execute()
resp, r, err := apiClient.SearchAPI.Search(context.Background()).SearchRequest(searchRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SearchAPI.Percolate``: %v\n", err)
fmt.Fprintf(os.Stderr, "Error when calling `SearchAPI.Search``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `Percolate`: SearchResponse
fmt.Fprintf(os.Stdout, "Response from `SearchAPI.Percolate`: %v\n", resp)
// response from `Search`: SearchResponse
fmt.Fprintf(os.Stdout, "Response from `SearchAPI.Search`: %v\n", resp)
}
```

### Path Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**index** | **string** | Name of the percolate index |

### Other Parameters

Other parameters are passed through a pointer to a apiPercolateRequest struct via the builder pattern
Other parameters are passed through a pointer to a apiSearchRequest struct via the builder pattern


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------

**percolateRequest** | [**PercolateRequest**](PercolateRequest.md) | |
**searchRequest** | [**SearchRequest**](SearchRequest.md) | |

### Return type

Expand All @@ -81,11 +76,11 @@ No authorization required
[[Back to README]](../README.md)


## Search
## Percolate

> SearchResponse Search(ctx).SearchRequest(searchRequest).Execute()
> SearchResponse Percolate(ctx, index).PercolateRequest(percolateRequest).Execute()
Performs a search on an index
Perform reverse search on a percolate index



Expand All @@ -102,32 +97,38 @@ import (
)

func main() {
searchRequest := *openapiclient.NewSearchRequest("test") // SearchRequest |
index := "index_example" // string | Name of the percolate index
percolateRequest := *openapiclient.NewPercolateRequest(*openapiclient.NewPercolateRequestQuery(map[string]interface{}(123))) // PercolateRequest |

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.SearchAPI.Search(context.Background()).SearchRequest(searchRequest).Execute()
resp, r, err := apiClient.SearchAPI.Percolate(context.Background(), index).PercolateRequest(percolateRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SearchAPI.Search``: %v\n", err)
fmt.Fprintf(os.Stderr, "Error when calling `SearchAPI.Percolate``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `Search`: SearchResponse
fmt.Fprintf(os.Stdout, "Response from `SearchAPI.Search`: %v\n", resp)
// response from `Percolate`: SearchResponse
fmt.Fprintf(os.Stdout, "Response from `SearchAPI.Percolate`: %v\n", resp)
}
```

### Path Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**index** | **string** | Name of the percolate index |

### Other Parameters

Other parameters are passed through a pointer to a apiSearchRequest struct via the builder pattern
Other parameters are passed through a pointer to a apiPercolateRequest struct via the builder pattern


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**searchRequest** | [**SearchRequest**](SearchRequest.md) | |

**percolateRequest** | [**PercolateRequest**](PercolateRequest.md) | |

### Return type

Expand Down

0 comments on commit 3aec930

Please sign in to comment.