# Search (IRPCSearch)

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)

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

An interface for performing searches.

All search operations can be done via this interface.

- **gRPC service:** `MFiles.IRPCSearch`
- **Book and level:** [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md), core
- **Methods:** 14
- **Proto file:** [`mfiles/IRPCSearch.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/IRPCSearch.proto)

<a id="overview"></a>

## Overview

Use this service to find objects by conditions, to count them, and to browse views the way the
M-Files clients do.

| Job | Method |
| --- | --- |
| Find objects that match conditions | [SearchObjects](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/SearchObjects/index.md) |
| Count matching objects without fetching them | [GetObjectCountInSearch](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetObjectCountInSearch/index.md) |
| Browse views, view levels and their objects | [GetFolderContents](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFolderContents/index.md) |
| Facet counts for a full-text search UI | [GetFacetValues](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFacetValues/index.md) |

The other methods serve specific M-Files client features (hit highlighting, listing counts,
notification badges, pinboard, Aino Search and summaries).

**Condition model.** A search is a [SearchConditionArray](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchConditionArray/index.md);
all of its conditions must match (AND). `SearchObjects` and `GetObjectCountInSearch` accept
exactly one array: an empty request or two or more arrays fail with "The parameter is incorrect."
To match one of several values of a lookup, use `CONDITION_TYPE_EQUAL` with a multi-select lookup
value that lists them; for other OR cases, run one search per alternative.
An array with no conditions matches every object the caller can see.

**What a search returns.**

- Only objects the caller is allowed to see: the same search returns fewer objects for a normal
  user than for a vault administrator.
- Deleted objects too, for callers who may see deleted objects (vault administrators, for
  example), unless the array contains the "not deleted" condition: a `STATUS_TYPE_IS_DELETED`
  status value `CONDITION_TYPE_EQUAL` to Boolean `false`. Add it to every search.
- One version per object: the latest checked-in version, or the checked-out version when the
  object is checked out to the caller.
- Object and version information without the property values. Read the properties with
  [GetObjectVersionAndPropertiesOfMultipleObjects](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/GetObjectVersionAndPropertiesOfMultipleObjects/index.md).

**Limits and timeouts.** In `SearchObjects`, `limit` and `timeout_in_seconds` left at 0 mean no
limit and no timeout; the server does not apply a default. Set both. A vault administrator can
configure forced maxima that cap both values. `GetObjectCountInSearch` counts up to 10,000
objects by default and reports larger counts as "more than".

**Errors.** Search errors arrive with gRPC status `UNKNOWN` and the M-Files error message as the
status details, for example "Invalid search condition." for a condition the server cannot
evaluate.

The [Search concept](https://developer.m-files.com/APIs/gRPC-API/concepts/search/index.md) shows the
conditions you need most as complete messages, and the
[paging guide](https://developer.m-files.com/APIs/gRPC-API/guides/paging/index.md) reads a large result
set page by page.

<a id="highlighted"></a>

## Highlighted methods

| Method | Summary | Facts |
|---|---|---|
| [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. | `read` `session or assertion` `idempotent` `returns metadata structure version` |
| [GetObjectCountInSearch](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetObjectCountInSearch/index.md) | Counts the objects that match the given conditions without returning them. | `read` `session or assertion` `idempotent` `returns metadata structure version` |
| [GetFacetValues](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFacetValues/index.md) | Retrieves the facet values for the documents that satisfy the specified search conditions. | `read` `session or assertion` `idempotent` `returns metadata structure version` |
| [GetFolderContents](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFolderContents/index.md) | Lists the contents of a view or a view level: subviews, grouping folders and objects. | `read` `session or assertion` `idempotent` `returns metadata structure version` |

<a id="methods"></a>

## Other methods

| Method | Summary | Facts |
|---|---|---|
| [CreateSummarization](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/CreateSummarization/index.md) | Creates an Aino summary for the M-Files clients. | `write` `session or assertion` `idempotent` `returns metadata structure version` |
| [GetFolderContentsOfPinboard](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFolderContentsOfPinboard/index.md) | Gets the contents of the Pinboard items. | `write` `session or assertion` `returns metadata structure version` |
| [GetFolderContentsOrDelta](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFolderContentsOrDelta/index.md) | Gets the contents of the specified folder, or a delta that indicates changes to document vault data since the logical timestamp known by the caller. | `read` `session or assertion` `idempotent` `returns metadata structure version` |
| [GetFolderObjectsCount](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFolderObjectsCount/index.md) | Gets the count of objects in the specified folder. | `read` `session or assertion` `idempotent` `returns metadata structure version` |
| [GetObjectsCountForNotifications](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetObjectsCountForNotifications/index.md) | Gets the objects count for notification badge. | `read` `session or assertion` `idempotent` |
| [GetPrefillProperties](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetPrefillProperties/index.md) | Gets the property values that a new object created in the given folder gets from that folder. | `read` `session or assertion` `idempotent` |
| [GetSearchHits](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetSearchHits/index.md) | Finds the words of a text that a full-text search condition matches, for hit highlighting. | `read` `session or assertion` `idempotent` `returns metadata structure version` |
| [QuerySearchAgent](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/QuerySearchAgent/index.md) | Runs an Aino Search query for the M-Files clients. | `read` `session or assertion` `idempotent` `returns metadata structure version` |
| [SearchReferencedValueListItems](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/SearchReferencedValueListItems/index.md) | Gets value list items that are referenced by one or more documents (possibly limiting the set of documents with conditions) in ID order. | `write` `session or assertion` |
| [SearchViewLevelFolders](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/SearchViewLevelFolders/index.md) | The search covers the folders that the listing of the level would show without the folder limit. The results can be saved as part of the user's folder selection. Fails with E_NOTIMPL when the feature is not enabled on the server. | `read` `session or assertion` `idempotent` `returns metadata structure version` |
