Devhelp.KeywordModel.filter

### Method

# Devhelp KeywordModelfilter

#### Declaration [src]

    DhLink*
    dh_keyword_model_filter (
      DhKeywordModel* model,
      const gchar* search_string,
      const gchar* current_book_id,
      DhProfile* profile
    )

#### Description [src]

Searches in the `DhBookList` of `profile` the list of `DhLink`‘s that correspond to `search_string`, and fills the `model` with that list (erasing the previous content).

Attention, when calling this function the `model` needs to be disconnected from the `GtkTreeView`, because the `GtkTreeModel` signals are not emitted, to improve the performances (sending a lot of signals is slow) and have a simpler implementation. The previous row selection is anyway no longer relevant.

Note that there is a maximum number of matches (configured internally). When the maximum is reached the search is stopped, to avoid blocking the GUI (since this function runs synchronously) if the `search_string` contains for example only one character. (And it is anyway not very useful to show to the user tens of thousands search results).

#### Parameters

`search_string`

  Type: `const gchar*`

  A search query.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`current_book_id`

  Type: `const gchar*`

  The ID of the book currently shown, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`profile`

  Type: `DhProfile`

  A `DhProfile`, or `NULL` for the default profile.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

#### Return value

Type: `DhLink`

The `DhLink` that matches exactly `search_string`, or `NULL` if no such `DhLink` was found within the maximum number of matches.

The returned data is owned by the instance.
The return value can be `NULL`.