Skip to content

Commit 1f74dc5

Browse files
committed
Updated SearchApi and respective tests and docs, regenerated the client
1 parent b694f7c commit 1f74dc5

File tree

10 files changed

+685
-98
lines changed

10 files changed

+685
-98
lines changed

docs/SearchApi.md

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ Method | HTTP request | Description
1414
1515
Performs a search on an index.
1616

17-
The method expects an object with the following mandatory properties:
17+
The method expects a SearchRequest object with the following mandatory properties:
1818

19-
* the name of the index to search
19+
* the name of the index to search | string
2020

21-
* the match query object
22-
2321
For details, see the documentation on [**SearchRequest**](SearchRequest.md)
2422

2523
The method returns an object with the following properties:
@@ -76,14 +74,14 @@ var searchRequest = new Manticoresearch.SearchRequest();
7674
searchRequest.index = "test";
7775
searchRequest.fulltext_filter = new Manticoresearch.QueryFilter('Star Trek 2');
7876

79-
// or create SearchRequest in an alternative way
77+
// or create SearchRequest in an alternative way as in the previous versions of the client. It uses a single complex JSON object for a query field
8078
searchRequest = {"index":"test","query":{"query_string":"find smth"}};
8179

8280
// Perform a search
83-
async function(){
81+
(async function searchExample() {
8482
var res = await searchApi.search(searchRequest);
8583
console.log(JSON.stringify(res, null, 4));
86-
}
84+
})();
8785

8886
```
8987

@@ -111,13 +109,13 @@ No authorization required
111109

112110
> SearchResponse percolate(index, percolateRequest)
113111
114-
Perform a reverse search on a percolate index
112+
Performs a reverse search on a percolate index. [[More info on percolate indexes in Manticore Search Manual]](https://manual.manticoresearch.com/Creating_a_table/Local_tables/Percolate_table#Percolate-table)
115113

116-
Performs a percolate search.
117114
This method must be used only on percolate indexes.
118115

119-
Expects two parameters: the index name and an object with an array of documents to search with.
120-
Here is an example of the document object:
116+
Expects two parameters: the index name and an object with a document or an array of documents to search by.
117+
Here is an example of the object with a single document:
118+
121119
```
122120
{
123121
"query":
@@ -126,7 +124,7 @@ Here is an example of the document object:
126124
{
127125
"document":
128126
{
129-
"title":"sample content"
127+
"content":"sample content"
130128
}
131129
}
132130
}
@@ -163,16 +161,37 @@ Responds with an object with matched stored queries:
163161
}
164162
```
165163

164+
And here is an example of the object with multiple documents:
165+
166+
```
167+
{
168+
"query":
169+
{
170+
"percolate":
171+
{
172+
"documents": [
173+
{
174+
"content":"sample content"
175+
},
176+
{
177+
"content":"another sample content"
178+
}
179+
]
180+
}
181+
}
182+
}
183+
```
184+
166185

167186
### Example
168187

169188
```javascript
170189
var Manticoresearch = require('manticoresearch');
171190

172191
var searchApi = new Manticoresearch.SearchApi();
173-
async function() {
192+
(async function percolateExample() {
174193
res = await searchApi.percolate('products',{"query":{"percolate":{"document":{"title":"What a nice bag"}}}});
175-
}
194+
})();
176195

177196
```
178197

docs/SearchRequest.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Name | Type | Description | Notes
1212
**offset** | **Number** | | [optional]
1313
**maxMatches** | **Number** | | [optional]
1414
**sort** | **[Object]** | | [optional]
15-
**sortOld** | **[Object]** | | [optional]
1615
**aggs** | [**[Aggregation]**](Aggregation.md) | | [optional]
1716
**expressions** | **[Object]** | | [optional]
1817
**highlight** | [**Highlight**](Highlight.md) | | [optional]

0 commit comments

Comments
 (0)