Skip to content

Commit

Permalink
Regenerated the client
Browse files Browse the repository at this point in the history
  • Loading branch information
nick committed Oct 22, 2024
1 parent 1ecbe62 commit d1a2481
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import manticoresearch

Please follow the [installation procedure](#installation--usage) and then run the following:

```python
```python
import manticoresearch
from manticoresearch.rest import ApiException
from pprint import pprint
Expand All @@ -70,10 +70,26 @@ with manticoresearch.ApiClient(configuration) as api_client:
searchApi = manticoresearch.SearchApi(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)

newDoc = {"title" : "Pet Hair Remover Glove", "price": 7.99}
insert_request = InsertDocumentRequest(index="products", doc=newDoc)
indexApi.insert(insert_request)
query_highlight = Highlight()
query_highlight.fields = {"title":{}}
search_query = SearchQuery(query_string="@title bag")
search_request = SearchRequest(index="products", query=search_query, highlight=query_highlight)
search_response = searchApi.search(search_request)
print("The response of SearchApi->search:\n")
pprint(search_response)

# Alternatively, you can pass all request arguments as JSON strings
indexApi.insert({"index": "products", "doc" : {"title" : "Crossbody Bag with Tassel", "price" : 19.85}})
indexApi.insert({"index": "products", "doc" : {"title" : "Pet Hair Remover Glove", "price" : 7.99}})
search_response = searchApi.search({"index": "products", "query": {"query_string": "@title bag"}, "highlight":{"fieldnames":["title"]}})
search_response = searchApi.search({"index": "products", "query": {"query_string": "@title bag"}, "highlight":{"fields":{"title":{}}}})
print("The response of SearchApi->search:\n")
pprint(search_response)
except ApiException as e:
Expand Down

0 comments on commit d1a2481

Please sign in to comment.