Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/provider/ContactsContract.SearchSnippets#constants) \| [Ctors](https://developer.android.com/reference/android/provider/ContactsContract.SearchSnippets#pubctors) \| [Inherited Methods](https://developer.android.com/reference/android/provider/ContactsContract.SearchSnippets#inhmethods)

# ContactsContract.SearchSnippets

*** ** * ** ***

` public static class ContactsContract.SearchSnippets `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.provider.ContactsContract.SearchSnippets |

<br />

*** ** * ** ***

Additional column returned by `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI` explaining why the filter matched the contact. This column will contain extracts from the contact's constituent `https://developer.android.com/reference/android/provider/ContactsContract.Data` items, formatted in a way that indicates the section of the snippet that matched the filter.

The following example searches for all contacts that match the query "presi" and requests the snippet column as well.

```
Builder builder = Contacts.CONTENT_FILTER_URI.buildUpon();
builder.appendPath("presi");
// Defer snippeting to the client side if possible, for performance reasons.
builder.appendQueryParameter(SearchSnippets.DEFERRED_SNIPPETING_KEY,"1");

Cursor cursor = getContentResolver().query(builder.build());

Bundle extras = cursor.getExtras();
if (extras.getBoolean(ContactsContract.DEFERRED_SNIPPETING)) {
    // Do our own snippet formatting.
    // For a contact with the email address (president@organization.com), the snippet
    // column will contain the string "president@organization.com".
} else {
    // The snippet has already been pre-formatted, we can display it as is.
    // For a contact with the email address (president@organization.com), the snippet
    // column will contain the string "[presi]dent@organization.com".
}
```

<br />

<br />

## Summary

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.SearchSnippets#DEFERRED_SNIPPETING_KEY` The key to ask the provider to defer the formatting of the snippet to the client if possible, for performance reasons. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.SearchSnippets#SNIPPET` The search snippet constructed by SQLite snippeting functionality. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/provider/ContactsContract.SearchSnippets#SearchSnippets()() ` |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### DEFERRED_SNIPPETING_KEY

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String DEFERRED_SNIPPETING_KEY
```

The key to ask the provider to defer the formatting of the snippet to the client if possible, for performance reasons. A value of 1 indicates true, 0 indicates false. False is the default. When a cursor is returned to the client, it should check for an extra with the name `https://developer.android.com/reference/android/provider/ContactsContract#DEFERRED_SNIPPETING` in the cursor. If it exists, the client should do its own formatting of the snippet. If it doesn't exist, the snippet column in the cursor should already contain a formatted snippet.

<br />

Constant Value: "deferred_snippeting"

### SNIPPET

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String SNIPPET
```

The search snippet constructed by SQLite snippeting functionality.

The snippet may contain (parts of) several data elements belonging to the contact, with the matching parts optionally surrounded by special characters that indicate the start and end of matching text. For example, if a contact has an address "123 Main Street", using a filter "mai" would return the formatted snippet "123 \[Mai\]n street".

<br />

**See also:**

- <http://www.sqlite.org/fts3.html#snippet>

Constant Value: "snippet"

## Public constructors

### SearchSnippets

```
public SearchSnippets ()
```

<br />

<br />