Skip to content

Commit

Permalink
Fixed docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nick committed Jan 30, 2025
1 parent 2bd5fba commit c355286
Show file tree
Hide file tree
Showing 23 changed files with 228 additions and 44 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,3 @@ jobs:
VERSION=`git log -1 --date=format:"%y%m%d%H" --format=%cd|head`
echo "version $VERSION"
sed -i -E "s/(VERSION = \")([0-9]\.[0-9]\.)(.*)(\")/\1\2$VERSION\4/1" setup.py
- name: Publish
run: |
echo $PYPIRC > ~/.pypirc
python -m pip install --user --upgrade wheel
python -m pip install --user --upgrade twine
python setup.py sdist bdist_wheel
python -m twine upload dist/* -u __token__ -p $PYPI_TOKEN
3 changes: 3 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ docs/SearchRequest.md
docs/SearchResponse.md
docs/SearchResponseHits.md
docs/SourceRules.md
docs/SqlResponse.md
docs/SuccessResponse.md
docs/UpdateDocumentRequest.md
docs/UpdateResponse.md
Expand Down Expand Up @@ -89,6 +90,7 @@ manticoresearch/models/search_request.py
manticoresearch/models/search_response.py
manticoresearch/models/search_response_hits.py
manticoresearch/models/source_rules.py
manticoresearch/models/sql_response.py
manticoresearch/models/success_response.py
manticoresearch/models/update_document_request.py
manticoresearch/models/update_response.py
Expand Down Expand Up @@ -136,6 +138,7 @@ test/test_search_request.py
test/test_search_response.py
test/test_search_response_hits.py
test/test_source_rules.py
test/test_sql_response.py
test/test_success_response.py
test/test_update_document_request.py
test/test_update_response.py
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Сlient for Manticore Search.


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

## Requirements.

Expand Down Expand Up @@ -68,12 +68,18 @@ with manticoresearch.ApiClient(configuration) as api_client:
# Create instances of API classes
indexApi = manticoresearch.IndexApi(api_client)
searchApi = manticoresearch.SearchApi(api_client)
utilsApi = manticoresearch.UtilsApi(api_client)

try:
# Perform insert and search operations
newDoc = {"title" : "Crossbody Bag with Tassel", "price": 19.85}
insert_request = InsertDocumentRequest(index="products", doc=newDoc)
indexApi.insert(insert_request)

# Check out the structure of the autocreated 'products' table
sql_response = utilsApi.sql('DESC products');
print("The response of UtilsApi->sql:\n")
pprint(sql_response)

newDoc = {"title" : "Pet Hair Remover Glove", "price": 7.99}
insert_request = InsertDocumentRequest(index="products", doc=newDoc)
Expand Down Expand Up @@ -150,6 +156,7 @@ Class | Method | HTTP request | Description
- [SearchResponse](docs/SearchResponse.md)
- [SearchResponseHits](docs/SearchResponseHits.md)
- [SourceRules](docs/SourceRules.md)
- [SqlResponse](docs/SqlResponse.md)
- [SuccessResponse](docs/SuccessResponse.md)
- [UpdateDocumentRequest](docs/UpdateDocumentRequest.md)
- [UpdateResponse](docs/UpdateResponse.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/BulkResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Name | Type | Description | Notes
**items** | **List[object]** | List of results | [optional]
**errors** | **bool** | Errors occurred during the bulk operation | [optional]
**error** | **str** | Error message describing an error if such occurred | [optional]
**current_line** | **int** | Number of the row returned in the response | [optional]
**skipped_lines** | **int** | Number of rows skipped in the response | [optional]

## Example

Expand Down
4 changes: 2 additions & 2 deletions docs/IndexApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ with manticoresearch.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = manticoresearch.IndexApi(api_client)
index = 'index_example' # str | Name of the percolate index
id = 3.4 # float | Id of the document to replace
id = 56 # int | Id of the document to replace
replace_document_request = {"doc":{"price":20}} # ReplaceDocumentRequest |

try:
Expand All @@ -270,7 +270,7 @@ with manticoresearch.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**index** | **str**| Name of the percolate index |
**id** | **float**| Id of the document to replace |
**id** | **int**| Id of the document to replace |
**replace_document_request** | [**ReplaceDocumentRequest**](ReplaceDocumentRequest.md)| |

### Return type
Expand Down
4 changes: 2 additions & 2 deletions docs/SearchApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Method | HTTP request | Description
Perform reverse search on a percolate index

Performs a percolate search. This method must be used only on percolate indexes. Expects two parameters: the index name and an object with array of documents to be tested. An example of the documents object: ``` { \"query\": { \"percolate\": { \"document\": { \"content\":\"sample content\" } } } } ``` Responds with an object with matched stored queries: ``` { 'timed_out':false, 'hits': { 'total':2, 'max_score':1, 'hits': [ { '_index':'idx_pq_1', '_type':'doc', '_id':'2', '_score':'1', '_source': { 'query': { 'match':{'title':'some'} } } }, { '_index':'idx_pq_1', '_type':'doc', '_id':'5', '_score':'1', '_source': { 'query': { 'ql':'some | none' } } } ] } } ```
Performs a percolate search. <br><br> This method must be used only on percolate indexes. <br> Expects two parameters: the index name and an object with array of documents to be tested. <br> <br> An example of the documents object: <br> { <br> &nbsp;&nbsp;\"query\" {<br> &nbsp;&nbsp;&nbsp;&nbsp;\"percolate\": {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"document\": { <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"content\":\"sample content\" <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br> &nbsp;&nbsp;&nbsp;&nbsp;} <br> &nbsp;&nbsp;} <br> } <br> <br> Responds with an object with matched stored queries: <br> { <br> &nbsp;&nbsp;'timed_out':false, <br> &nbsp;&nbsp;'hits': { <br> &nbsp;&nbsp;&nbsp;&nbsp;'total':2, <br> &nbsp;&nbsp;&nbsp;&nbsp;'max_score':1, <br> &nbsp;&nbsp;&nbsp;&nbsp;'hits': [ <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_index':'idx_pq_1', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_type':'doc', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_id':'2', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_score':'1', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_source': { <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'query': { <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'match':{'title':'some'} <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_index':'idx_pq_1', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_type':'doc', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_id':'5', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_score':'1', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '_source': { <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'query': { <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'ql':'some | none' <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br> &nbsp;&nbsp;&nbsp;&nbsp; ] <br> &nbsp;&nbsp; } <br> } <br> ```

### Example

Expand Down Expand Up @@ -85,7 +85,7 @@ No authorization required
Performs a search on an index

The method expects an object with the following mandatory properties: * the name of the index to search * the match query object For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON).
The method expects an object with the following mandatory properties: * the name of the index to search * the match query object For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Also, if pagination is enabled, the response will include an additional 'scroll' property with a scroll token to use for pagination Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON).

### Example

Expand Down
1 change: 1 addition & 0 deletions docs/SearchResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Name | Type | Description | Notes
**aggregations** | **object** | Aggregated search results grouped by the specified criteria | [optional]
**hits** | [**SearchResponseHits**](SearchResponseHits.md) | | [optional]
**profile** | **object** | Profile information about the search execution, if profiling is enabled | [optional]
**scroll** | **str** | Scroll token to be used fo pagination | [optional]
**warning** | **object** | Warnings encountered during the search operation | [optional]

## Example
Expand Down
27 changes: 27 additions & 0 deletions docs/SqlResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SqlResponse

List of responses from executed SQL queries

## Properties

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

## Example

```python
from manticoresearch.models.sql_response import SqlResponse

# create an instance of SqlResponse from a JSON string
sql_response_instance = SqlResponse.from_json(json)
# print the JSON string representation of the object
print(SqlResponse.to_json())

# convert the object into a dict
sql_response_dict = sql_response_instance.to_dict()
# create an instance of SqlResponse from a dict
sql_response_from_dict = SqlResponse.from_dict(sql_response_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


1 change: 1 addition & 0 deletions docs/SuccessResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Response object indicating the success of an operation, such as inserting or upd
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**index** | **str** | Name of the document index | [optional]
**table** | **str** | Name of the document table (alias of index) | [optional]
**id** | **int** | ID of the document affected by the request operation | [optional]
**created** | **bool** | Indicates whether the document was created as a result of the operation | [optional]
**result** | **str** | Result of the operation, typically &#39;created&#39;, &#39;updated&#39;, or &#39;deleted&#39; | [optional]
Expand Down
5 changes: 3 additions & 2 deletions docs/UtilsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Method | HTTP request | Description


# **sql**
> List[object] sql(body, raw_response=raw_response)
> SqlResponse sql(body, raw_response=raw_response)
Perform SQL requests

Expand All @@ -19,6 +19,7 @@ Run a query in SQL format. Expects a query string passed through `body` paramete

```python
import manticoresearch
from manticoresearch.models.sql_response import SqlResponse
from manticoresearch.rest import ApiException
from pprint import pprint

Expand Down Expand Up @@ -57,7 +58,7 @@ Name | Type | Description | Notes

### Return type

**List[object]**
[**SqlResponse**](SqlResponse.md)

### Authorization

Expand Down
3 changes: 2 additions & 1 deletion manticoresearch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
""" # noqa: E501


__version__ = "5.0.0"
__version__ = "6.0.0"

# import apis into sdk package
from manticoresearch.api.index_api import IndexApi
Expand Down Expand Up @@ -68,6 +68,7 @@
from manticoresearch.models.search_response import SearchResponse
from manticoresearch.models.search_response_hits import SearchResponseHits
from manticoresearch.models.source_rules import SourceRules
from manticoresearch.models.sql_response import SqlResponse
from manticoresearch.models.success_response import SuccessResponse
from manticoresearch.models.update_document_request import UpdateDocumentRequest
from manticoresearch.models.update_response import UpdateResponse
15 changes: 7 additions & 8 deletions manticoresearch/api/index_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictFloat, StrictInt, StrictStr
from typing import Union
from pydantic import Field, StrictInt, StrictStr
from typing_extensions import Annotated
from manticoresearch.models.bulk_response import BulkResponse
from manticoresearch.models.delete_document_request import DeleteDocumentRequest
Expand Down Expand Up @@ -864,7 +863,7 @@ def _insert_serialize(
def partial_replace(
self,
index: Annotated[StrictStr, Field(description="Name of the percolate index")],
id: Annotated[Union[StrictFloat, StrictInt], Field(description="Id of the document to replace")],
id: Annotated[StrictInt, Field(description="Id of the document to replace")],
replace_document_request: ReplaceDocumentRequest,
_request_timeout: Union[
None,
Expand All @@ -886,7 +885,7 @@ def partial_replace(
:param index: Name of the percolate index (required)
:type index: str
:param id: Id of the document to replace (required)
:type id: float
:type id: int
:param replace_document_request: (required)
:type replace_document_request: ReplaceDocumentRequest
:param _request_timeout: timeout setting for this request. If one
Expand Down Expand Up @@ -939,7 +938,7 @@ def partial_replace(
def partial_replace_with_http_info(
self,
index: Annotated[StrictStr, Field(description="Name of the percolate index")],
id: Annotated[Union[StrictFloat, StrictInt], Field(description="Id of the document to replace")],
id: Annotated[StrictInt, Field(description="Id of the document to replace")],
replace_document_request: ReplaceDocumentRequest,
_request_timeout: Union[
None,
Expand All @@ -961,7 +960,7 @@ def partial_replace_with_http_info(
:param index: Name of the percolate index (required)
:type index: str
:param id: Id of the document to replace (required)
:type id: float
:type id: int
:param replace_document_request: (required)
:type replace_document_request: ReplaceDocumentRequest
:param _request_timeout: timeout setting for this request. If one
Expand Down Expand Up @@ -1014,7 +1013,7 @@ def partial_replace_with_http_info(
def partial_replace_without_preload_content(
self,
index: Annotated[StrictStr, Field(description="Name of the percolate index")],
id: Annotated[Union[StrictFloat, StrictInt], Field(description="Id of the document to replace")],
id: Annotated[StrictInt, Field(description="Id of the document to replace")],
replace_document_request: ReplaceDocumentRequest,
_request_timeout: Union[
None,
Expand All @@ -1036,7 +1035,7 @@ def partial_replace_without_preload_content(
:param index: Name of the percolate index (required)
:type index: str
:param id: Id of the document to replace (required)
:type id: float
:type id: int
:param replace_document_request: (required)
:type replace_document_request: ReplaceDocumentRequest
:param _request_timeout: timeout setting for this request. If one
Expand Down
Loading

0 comments on commit c355286

Please sign in to comment.