diff --git a/docs/SearchApi.md b/docs/SearchApi.md index 698bebc..80d9a39 100755 --- a/docs/SearchApi.md +++ b/docs/SearchApi.md @@ -4,90 +4,40 @@ All URIs are relative to *http://127.0.0.1:9308* Method | HTTP request | Description ------------- | ------------- | ------------- -[**percolate**](SearchApi.md#percolate) | **POST** /json/pq/{index}/search | Perform reverse search on a percolate index -[**search**](SearchApi.md#search) | **POST** /json/search | Performs a search +[**percolate**](SearchApi.md#percolate) | **POST** /pq/{index}/search | Perform reverse search on a percolate index +[**search**](SearchApi.md#search) | **POST** /search | Performs search ## search -> SearchResponse search(searchRequest) - -Performs a search +Performs search +### Parameters -Expects an object with mandatory properties: -* the index name -* the match query object -Example : +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **searchRequest** | [**SearchRequest**](SearchRequest.md)| | -``` -{ - 'index':'movies', - 'query': - { - 'bool': - { - 'must': - [ - {'query_string':' movie'} - ] - } - }, - 'script_fields': - { - 'myexpr': - { - 'script': - { - 'inline':'IF(rating>8,1,0)' - } - } - }, - 'sort': - [ - {'myexpr':'desc'}, - {'_score':'desc'} - ], - 'profile':true -} -``` +### Return type -It responds with an object with: -- time of execution -- if the query timed out -- an array with hits (matched documents) -- additional, if profiling is enabled, an array with profiling information is attached +[**SearchResponse**](SearchResponse.md) +### Authorization -``` -{ - 'took':10, - 'timed_out':false, - 'hits': - { - 'total':2, - 'hits': - [ - { - '_id':'1', - '_score':1, - '_source':{'gid':11} - }, - { - '_id':'2', - '_score':1, - '_source':{'gid':12} - } - ] - } -} -``` +No authorization required -For more information about the match query syntax, additional paramaters that can be set to the input and response, please check: https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP. +### HTTP request headers +- **Content-Type**: application/json +- **Accept**: application/json -### Example +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **0** | error | - | +### Example: ```java import com.manticoresearch.client.ApiClient; @@ -120,7 +70,7 @@ public class SearchApiExample { ``` -#### SearchRequest +### SearchRequest [[Docs on search options in Manticore Search Manual]](https://manual.manticoresearch.com/Searching/Options#Search-options) ```java @@ -146,7 +96,7 @@ System.out.println( searchResponse.toString() ); ``` -##### SourceByRules +### SourceByRules [[SourceByRules - input parameters]](SourceByRules.md) @@ -165,7 +115,7 @@ System.out.println( searchResponse.toString() ); ``` -##### Sort +### Sort ```java //Setting the `Sort` property: List sort = new ArrayList( Arrays.asList("year") ); @@ -175,11 +125,12 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -##### SortOrder -##### SortMVA - +### SortOrder [[SortOrder - input parameters]](SortOrder.md) -[[SortMVA - input parameters](SortMVA.md) + +### SortMVA + +[[SortMVA - input parameters]](SortMVA.md) [[Docs on sorting in Manticore Search Manual]](https://manual.manticoresearch.com/Searching/Sorting_and_ranking#HTTP) ```java @@ -202,7 +153,7 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -##### Expressions +### Expressions [[Docs on expressions in Manticore Search Manual]](https://manual.manticoresearch.com/Searching/Expressions#Expressions-in-HTTP-JSON) ```java @@ -212,18 +163,18 @@ expr.put("expr1", "min(year,2900)"); List expressions = new ArrayList(); expressions.add(expr); expressions.add( - new HashMap(){{ - put("expr2","max(year,2100)"); + new HashMap(){{ + put("expr2","max(year,2100)"); - }} + }} ); searchRequest.setExpressions(expressions); - + SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -##### Aggregation +### Aggregation [[Aggregation - input parameters]](Aggregation.md) @@ -247,7 +198,7 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -##### Highlight +### Highlight [[Highlight - input parameters]](Highlight.md) @@ -265,7 +216,7 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -###### HighlightField +#### HighlightField [[HighlightField - input parameters]](HighlightField.md) @@ -283,8 +234,8 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -##### FulltextFilter -###### QueryFilter +### FulltextFilter +#### QueryFilter [[Docs on fulltext filters in Manticore Search Manual]](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP) @@ -294,28 +245,28 @@ System.out.println( searchResponse.toString() ); //Using a QueryFilter object QueryFilter queryFilter = new QueryFilter(); -queryFilter.setQueryString("Star Trek 2"); +queryFilter.setQueryString("Star Trek 2"); searchRequest.setFulltextFilter(queryFilter); SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -###### MatchFilter +#### MatchFilter [[MatchFilter - input parameters]](MatchFilter.md) ```java //Using a MatchFilter object MatchFilter matchFilter = new MatchFilter(); matchFilter.setQueryString("Nemesis"); -matchFilter.setQueryFields("title"); +matchFilter.setQueryFields("title"); searchRequest.setFulltextFilter(matchFilter); SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -###### MatchPhraseFilter +#### MatchPhraseFilter [[MatchPhraseFilter - input parameters]](MatchPhraseFilter.md) ```java @@ -329,7 +280,7 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -###### MatchOpFilter +#### MatchOpFilter [[MatchOpFilter - input parameters]](MatchOpFilter.md) ```java @@ -345,8 +296,8 @@ System.out.println( searchResponse.toString() ); ``` -##### AttrFilter -###### EqualsFilter +### AttrFilter +#### EqualsFilter [[EqualsFilter - input parameters]](EqualsFilter.md) @@ -364,7 +315,7 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -###### InFilter +#### InFilter [[InFilter - input parameters]](InFilter.md) @@ -380,7 +331,7 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -###### RangeFilter +#### RangeFilter [[RangeFilter - input parameters]](RangeFilter.md) @@ -397,7 +348,7 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -###### GeoDistanceFilter +#### GeoDistanceFilter [[GeoDistanceFilter - input parameters]](GeoDistanceFilter.md) @@ -419,7 +370,7 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -###### BoolFilter +#### BoolFilter [[BoolFilter - input parameters]](BoolFilter.md) @@ -457,7 +408,7 @@ System.out.println( searchResponse.toString() ); //Using nested bool filters boolFilter = new BoolFilter(); - + MatchFilter fulltextFilter = new MatchFilter(); fulltextFilter.setQueryString("Star"); fulltextFilter.setQueryFields("title"); @@ -473,12 +424,91 @@ SearchResponse searchResponse = searchApi.search(searchRequest); System.out.println( searchResponse.toString() ); ``` -### Parameters +## Raw search +Expects an object with mandatory properties: +* the index name +* the match query object + +### Example +``` +{ + 'index':'movies', + 'query': + { + 'bool': + { + 'must': + [ + {'query_string':' movie'} + ] + } + }, + 'script_fields': + { + 'myexpr': + { + 'script': + { + 'inline':'IF(rating>8,1,0)' + } + } + }, + 'sort': + [ + {'myexpr':'desc'}, + {'_score':'desc'} + ], + 'profile':true +} +``` + +It responds with an object with: +- time of execution +- if the query timed out +- an array with hits (matched documents) +- additional, if profiling is enabled, an array with profiling information is attached + + +``` +{ + '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, additional paramaters that can be set to the input and response, please check: https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP. + +## percolate + +Performs reverse search on a percolate index +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. + +### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **searchRequest** | [**SearchRequest**](SearchRequest.md)| | + **index** | **String**| Name of the percolate index | + **percolateRequest** | [**PercolateRequest**](PercolateRequest.md)| | ### Return type @@ -496,20 +526,9 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | Ok | - | +| **200** | items found | - | | **0** | error | - | - -## percolate - -> SearchResponse percolate(index, percolateRequest) - -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: ``` @@ -555,7 +574,6 @@ Responds with an object with matched stored queries: } ``` - ### Example ```java @@ -595,31 +613,3 @@ public class Example { } } ``` - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **index** | **String**| Name of the percolate index | - **percolateRequest** | [**PercolateRequest**](PercolateRequest.md)| | - -### Return type - -[**SearchResponse**](SearchResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | items found | - | -| **0** | error | - | -