Package org.linphone.core

# Interface MagicSearch

public interface MagicSearch
A `MagicSearch` is used to search for contacts from various sources:
-`FriendList`
-Ldap connection (see `Ldap`)
-Remote CardDAV server (see `CardDavParams`)
-Call logs, conferences and existing chat rooms. see: `getContactsListAsync(java.lang.String, java.lang.String, int, org.linphone.core.MagicSearch.Aggregation)`

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static enum`
`MagicSearch.Aggregation`
`static enum`
`MagicSearch.Source`

## Method Summary

Modifier and Type
Method
Description
`void`
`addListener(MagicSearchListener listener)`
`SearchResult[]`
`getContactsList(String filter, String domain, int sourceFlags, MagicSearch.Aggregation aggregation)`
Creates a sorted list of SearchResult which match with a filter word, from
SipUri in this order : Contact's display name, address username, address domain
and phone number.
`void`
`getContactsListAsync(String filter, String domain, int sourceFlags, MagicSearch.Aggregation aggregation)`
This is the asynchronous version of linphone_magic_search_get_contacts().
`String`
`getDelimiter()`
Gets the delimiter used for the search.
`SearchResult[]`
`getLastSearch()`
`boolean`
`getLimitedSearch()`
Returns whether or not the search is limited or not.
`int`
`getMaxWeight()`
Gets the maximum value used to calculate the weight in search.
`int`
`getMinWeight()`
Gets the minimum value used to calculate the weight in search.
`long`
`getNativePointer()`
Gets the native pointer used by this class to make native method calls.
`int`
`getSearchLimit()`
Gets the number of maximum search result the search will return.
`boolean`
`getUseDelimiter()`
Returns whether the delimiter is being used for the search.
`Object`
`getUserData()`
Gets the object stored in this object user's data
`void`
`removeListener(MagicSearchListener listener)`
`void`
`resetSearchCache()`
Reset the cache to begin a new search.
`void`
`setDelimiter(String delimiter)`
Sets the delimiter used to find matched filter word.
`void`
`setLimitedSearch(boolean limited)`
Enables or disables the limited search.
`void`
`setMaxWeight(int weight)`
Sets the maximum value used to calculate the weight in search.
`void`
`setMinWeight(int weight)`
Sets the minimum value used to calculate the weight in search.
`void`
`setSearchLimit(int limit)`
Sets the number of the maximum SearchResult which will be returned, if the
magic search isn't configured as unlimited with `setLimitedSearch(boolean)`.
`void`
`setUseDelimiter(boolean enable)`
Enable or disable the delimiter in search.
`void`
`setUserData(Object data)`
Sets the object to store in this object user's data
`String`
`toString()`

## Method Details

### getDelimiter

@Nullable String getDelimiter()
Gets the delimiter used for the search.

Returns:
  the delimiter used to find matched filter word

### setDelimiter

void setDelimiter(@Nullable String delimiter)
Sets the delimiter used to find matched filter word.

Parameters:
  `delimiter` - delimiter (example "-_.,")

### getLastSearch

@NonNull SearchResult[] getLastSearch()

Returns:
  sorted list of

### getLimitedSearch

boolean getLimitedSearch()
Returns whether or not the search is limited or not.
If not limited, the `getSearchLimit()` won't be applied.

Returns:
  true if the search is limited, false otherwise

### setLimitedSearch

void setLimitedSearch(boolean limited)
Enables or disables the limited search.
Even if configured as unlimited, the LDAP maxResults configuration parameter
still applies.

Parameters:
  `limited` - true to limit the search, false otherwise

### getMaxWeight

int getMaxWeight()
Gets the maximum value used to calculate the weight in search.

Returns:
  the maximum value used to calculate the weight in search

### setMaxWeight

void setMaxWeight(int weight)
Sets the maximum value used to calculate the weight in search.

Parameters:
  `weight` - maximum weight

### getMinWeight

int getMinWeight()
Gets the minimum value used to calculate the weight in search.

Returns:
  the minimum value used to calculate the weight in search

### setMinWeight

void setMinWeight(int weight)
Sets the minimum value used to calculate the weight in search.

Parameters:
  `weight` - minimum weight

### getSearchLimit

int getSearchLimit()
Gets the number of maximum search result the search will return.
The returned value doesn't take into account the "limited search" mode, so make
sure to check `getLimitedSearch()` result as well.

Returns:
  the number of the maximum `SearchResult` which will be returned
  if magic search is in limited mode.

### setSearchLimit

void setSearchLimit(int limit)
Sets the number of the maximum SearchResult which will be returned, if the
magic search isn't configured as unlimited with `setLimitedSearch(boolean)`.

Parameters:
  `limit` - the maximum number of `SearchResult` the search will return
  if magic search is in limited mode.

### getUseDelimiter

boolean getUseDelimiter()
Returns whether the delimiter is being used for the search.

Returns:
  if the delimiter search is used

### setUseDelimiter

void setUseDelimiter(boolean enable)
Enable or disable the delimiter in search.

Parameters:
  `enable` - true to use the delimiter, false otherwise

### getContactsList

@NonNull SearchResult[] getContactsList(@Nullable String filter, @Nullable String domain, int sourceFlags, MagicSearch.Aggregation aggregation)
Creates a sorted list of SearchResult which match with a filter word, from
SipUri in this order : Contact's display name, address username, address domain
and phone number.
The last item list will be an address formed with "filter" if a proxy config
exist and requested in sourceFlags During the first search, a cache is created
and used for the next search Use `resetSearchCache()` to begin a new
search

Parameters:
  `filter` - word we search
  `domain` - domain which we want to search only
  `sourceFlags` - Flags that specify where to search : `MagicSearch.Source`
  `aggregation` - a `MagicSearch.Aggregation` mode to indicate how to merge results
Returns:
  sorted list of

### getContactsListAsync

void getContactsListAsync(@Nullable String filter, @Nullable String domain, int sourceFlags, MagicSearch.Aggregation aggregation)
This is the asynchronous version of linphone_magic_search_get_contacts().
Creates a sorted list of SearchResult which match with a filter word, from
SipUri in this order : Contact's display name, address username, address domain
and phone number. The last item list will be an address formed with "filter" if
a proxy config exist and requested in sourceFlags During the first search, a
cache is created and used for the next search Use `resetSearchCache()` to
begin a new search

Parameters:
  `filter` - word we search
  `domain` - domain which we want to search only
  `sourceFlags` - Flags that specify where to search : `MagicSearch.Source`
  `aggregation` - a `MagicSearch.Aggregation` mode to indicate how to merge results

### resetSearchCache

void resetSearchCache()
Reset the cache to begin a new search.

### addListener

void addListener(MagicSearchListener listener)

### removeListener

void removeListener(MagicSearchListener listener)

### setUserData

void setUserData(Object data)
Sets the object to store in this object user's data

Parameters:
  `data` - the object to store

### getUserData

Object getUserData()
Gets the object stored in this object user's data

Returns:
  the object store if any, null otherwise

### getNativePointer

long getNativePointer()
Gets the native pointer used by this class to make native method calls.

Returns:
  the nativer pointer, as long

### toString

String toString()

Overrides:
  `toString` in class `Object`