# IRPCSearch.GetObjectCountInSearch

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Search](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetObjectCountInSearch/

Badges: `Vault API / core` `read` `session or assertion` `idempotent` `returns metadata structure version`

Counts the objects that match the given conditions without returning them.

- **Service:** [Search](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/index.md) `MFiles.IRPCSearch`
- **gRPC method:** `/MFiles.IRPCSearch/GetObjectCountInSearch`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-object-count-in-search`
- **Request:** [`GetObjectCountInSearchRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetObjectCountInSearch/index.md#request)
- **Response:** [`GetObjectCountInSearchResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetObjectCountInSearch/index.md#response)
- **Book and level:** Vault API, core
- **Kind:** read
- **Session:** Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
- **Idempotent:** yes
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

Takes the same conditions as [SearchObjects](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/SearchObjects/index.md) and counts
the same objects: latest versions the caller can see, deleted objects included unless excluded by a
condition. The result is one count for all object types together. The count stops at 10,000 by
default (a vault setting); a larger count is reported with `SRCOUNTFLAGS.more_than`. No search
timeout is applied.

<a id="request"></a>

## Request: GetObjectCountInSearchRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `callimp` | [`CallImportance`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.CallImportance/index.md) | The importance level of this call. Typically `CALL_IMPORTANCE_NORMAL`. Values: `CALL_IMPORTANCE_DEFAULT` (0), `CALL_IMPORTANCE_NORMAL` (1), `CALL_IMPORTANCE_CAN_BE_REJECTED` (2). |
| `search_options` | [`SearchTarget`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchTarget/index.md) | The search index and search mode. Leave unset for the vault's default index. |
| `search_options.index` | `string` | The name of the search index to use. Empty uses the vault's default index. An unknown name fails with "Target index is not available." |
| `search_options.mode` | [`SearchMode`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.SearchMode/index.md) | Whether to prefer, require or avoid the full-text search engine. See [SearchMode](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.SearchMode/index.md). Values: `SEARCH_MODE_DEFAULT` (0), `SEARCH_MODE_FAVOR_FULL_TEXT_SEARCH` (1), `SEARCH_MODE_REQUIRE_FULL_TEXT_SEARCH` (2), `SEARCH_MODE_REQUIRE_DATABASE_SEARCH` (3). |
| `search_options.search_master_storage` | `bool` | True to also search objects kept in Master Storage, where the vault supports it. |
| `search_options.continuation_token` | `string` | Continuation token for paging results from Master Storage. `SearchObjects` does not support it and fails with "Continuation token is not supported." when it is set together with `search_master_storage`. |
| `search_condition_arrays[]` | repeated [`SearchConditionArray`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchConditionArray/index.md) | Exactly one condition array; all of its conditions must match. No array or more than one array fails with "The parameter is incorrect." |
| `search_condition_arrays[].value[]` | repeated [`SearchCondition`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchCondition/index.md) | The conditions. All of them must match. |
| `search_condition_arrays[].value[].expression` | [`Expression`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Expression/index.md) | The left side of the condition: what is evaluated for each object, such as a property value, a status value or any field (full-text search). |
| `search_condition_arrays[].value[].type` | [`ConditionType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ConditionType/index.md) | The comparison operator. |
| `search_condition_arrays[].value[].value` | [`TypedValue`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.TypedValue/index.md) | The right side of the condition: the value to compare with. Its data type must suit the expression, for example a lookup for a lookup property, Boolean for `STATUS_TYPE_IS_DELETED`. |
| `searchflags` | [`SearchFlags`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchFlags/index.md) | Search flags. `look_in_all_versions` and `return_latest_visible_version` are not supported and fail with "Invalid search condition." |
| `searchflags.all` | `bool` | All flags set, including any future flags. Do not use in searches. |
| `searchflags.look_in_all_versions` | `bool` | Also match older versions; each object is returned once. Cannot be combined with `sorting`, and `GetObjectCountInSearch` rejects it. |
| `searchflags.return_latest_visible_version` | `bool` | Return the latest visible version for each matching document. |
| `searchflags.separately_search_in_each_object_type` | `bool` | Search each object type separately and merge the results. The `limit` then applies to each object type, and `pages_with_more_results` lists the object types whose results were cut. |
| `searchflags.allow_quick_refresh_for_external_object_types` | `bool` | If a search with an external ID condition on an external object type finds nothing, refresh the object type from its external database and search again. |
| `searchflags.disable_relevancy_ranking` | `bool` | Do not rank the results by relevance. |
| `searchflags.separately_search_specific_object_types` | `bool` | Allows only specified object types to be searched separately. |
| `searchflags.include_unmanaged_objects` | `bool` | Extends the search to include unmanaged objects. |
| `searchflags.individual_limit_for_each_external_repository` | `bool` | Ensures that up to the specified maximum number of results are returned from each repository. |

<a id="response"></a>

## Response: GetObjectCountInSearchResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `psrcountarr[]` | repeated [`SearchResultsCount`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchResultsCount/index.md) | One count, with `group_id` -100 (all object types). `flags.exact_measure` means `count` is exact; `flags.more_than` means more objects match than `count`. |
| `psrcountarr[].group_id` | `int32` | The group that was counted: an object type ID, or -100 for all object types. |
| `psrcountarr[].flags` | [`SRCOUNTFLAGS`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SRCOUNTFLAGS/index.md) | How to read `count`: `exact_measure` if exact, `more_than` if more objects match. |
| `psrcountarr[].flags.all` | `bool` | Specifies all flags set; Including any future flags. |
| `psrcountarr[].flags.exact_measure` | `bool` | If available, the reported result count is an exact measure. |
| `psrcountarr[].flags.more_than` | `bool` | If available, the reported result count is not an exact measure but it indicates that an exact count is more than the reported count. |
| `psrcountarr[].flags.multi_phase_initial` | `bool` | If available, the reported result count is based on the added items only. |
| `psrcountarr[].flags.multi_phase_count_only` | `bool` | If available, the reported result count is to be associated with a group without actual results. |
| `psrcountarr[].flags.multi_phase` | `bool` | If available, the reported result count supports multi-phase search, and it is to be associated with the initial result count rather than the total count. |
| `psrcountarr[].flags.additional_items` | `bool` | Identifies a search results count. |
| `psrcountarr[].count` | `uint32` | The number of matching objects. |
| `search_output_info` | [`SearchOutputInfo`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchOutputInfo/index.md) | Additional information about the completed search operation. |
| `search_output_info.processing_time_at_engine_in_milliseconds` | `int32` | The processing time at the search engine, in milliseconds. -1 if not known. |
| `search_output_info.processing_time_at_engine_from_mfserver_in_milliseconds` | `int32` | The processing time at the search engine, including network roundtrip from MFServer, in milliseconds. -1 if not known. |
| `search_output_info.processing_time_at_mfserver_in_milliseconds` | `int32` | The total processing time at MFServer, in milliseconds. -1 if not known. |
| `search_output_info.processing_time_at_mfserver_from_client_in_milliseconds` | `int32` | The total processing time at MFServer, including network roundtrip from the client, in milliseconds. -1 if not known. |

<a id="related"></a>

## Related methods

- [SearchObjects](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/SearchObjects/index.md): Searches the vault for objects that match the given conditions.
