## IdeSearchReducer IdeSearchReducer — Reduces the number of search results created |

## Functions

void | ide_search_reducer_init ()
gboolean | ide_search_reducer_accepts ()
void | ide_search_reducer_take ()
void | ide_search_reducer_push ()
void | ide_search_reducer_destroy ()
GPtrArray * | ide_search_reducer_free ()

## Description

This is a helper structure for search engines to reduce the number of items they inflate when performing a search.

## Functions

### ide_search_reducer_init ()

    void
    ide_search_reducer_init (IdeSearchReducer *reducer,
                             gsize max_results);

Initializes a new IdeSearchReducer to be used to reduce the number of search results that are created. This is generally just used to help keep search performance good.

#### Parameters

reducer | The reducer to initialize. | [out]
max_results | max result size for the reuslts |

Since: 3.32

### ide_search_reducer_accepts ()

    gboolean
    ide_search_reducer_accepts (IdeSearchReducer *reducer,
                                gfloat score);

This helper allows you to check if a result with `score` would be allowed into the result set, or if the score is too low. This helps in situations where you want to avoid inflating an IdeSearchResult unless necessary.

#### Parameters

reducer | a IdeSearchReducer |
score | a score for the result |

#### Returns

`TRUE` if there is space for a result with a score of `score` .

Since: 3.32

### ide_search_reducer_take ()

    void
    ide_search_reducer_take (IdeSearchReducer *reducer,
                             IdeSearchResult *result);

Like `ide_search_reducer_push()` but takes ownership of `result` by stealing the reference.

#### Parameters

reducer | an IdeSearchReducer |
result | an IdeSearchResult. | [transfer full]

Since: 3.32

### ide_search_reducer_push ()

    void
    ide_search_reducer_push (IdeSearchReducer *reducer,
                             IdeSearchResult *result);

Adds result to the set unless it scores too low.

#### Parameters

reducer | an IdeSearchReducer |
result | an IdeSearchResult |

Since: 3.32

### ide_search_reducer_destroy ()

    void
    ide_search_reducer_destroy (IdeSearchReducer *reducer);

Frees the results.

#### Parameters

reducer | a IdeSearchReducer |

Since: 3.32

### ide_search_reducer_free ()

    GPtrArray *
    ide_search_reducer_free (IdeSearchReducer *reducer,
                             gboolean free_results);

Frees all items associated with the result set, unless `free_results` is `FALSE` and then the results are returned as an array.

#### Parameters

reducer | a IdeSearchReducer |
free_results | `TRUE` if the results should be discarded |

#### Returns

An array of IdeSearchResult unless `free_results` is `TRUE`, then `NULL` is returned.

[nullable][transfer container][element-type IdeSearchResult]

Since: 3.32