AsSearchQuery: AppStream Library Reference Manual

## AsSearchQuery AsSearchQuery — An Appstream database search query |

## Functions

AsSearchQuery * | as_search_query_new ()
AsSearchQuery * | as_search_query_construct ()
void | as_search_query_set_search_term ()
gboolean | as_search_query_get_search_all_categories ()
gchar ** | as_search_query_get_categories ()
void | as_search_query_set_search_all_categories ()
void | as_search_query_set_categories ()
void | as_search_query_set_categories_from_string ()
void | as_search_query_sanitize_search_term ()
const gchar * | as_search_query_get_search_term ()

## Properties

GStrv | categories | Read / Write
gchar * | search-term | Read / Write

## Object Hierarchy

        GObject
        ╰── AsSearchQuery

## Includes

    #include <appstream.h>

## Description

This object defines a search run in the Appstream components database. It contains a string to search for, as well as information which categories should be searched. It also applies some sanity checks and improvements to the entered search string.

See also: AsDatabase

## Functions

### as_search_query_new ()

    AsSearchQuery *
    as_search_query_new (const gchar *term);

Creates a new AsSearchQuery.

#### Parameters

term | the string to search for |

#### Returns

a new AsSearchQuery.

[transfer full]

### as_search_query_construct ()

    AsSearchQuery *
    as_search_query_construct (GType object_type,
                               const gchar *term);

Construct a new AsSearchQuery.

#### Returns

a new AsSearchQuery.

[transfer full]

### as_search_query_set_search_term ()

    void
    as_search_query_set_search_term (AsSearchQuery *self,
                                     const gchar *value);

Set the search-term we use for the search. Multiple terms may be comma-separated. You can use Xapian prefixes, such as "XP" to refine your search.

#### Parameters

self | an instance of AsSearchQuery |
value | the string to search for |

### as_search_query_get_search_all_categories ()

    gboolean
    as_search_query_get_search_all_categories
                                   (AsSearchQuery *self);

#### Returns

TRUE if we search in all categories

### as_search_query_get_categories ()

    gchar **
    as_search_query_get_categories (AsSearchQuery *self);

#### Returns

String array of categories.

[transfer full]

### as_search_query_set_search_all_categories ()

    void
    as_search_query_set_search_all_categories
                                   (AsSearchQuery *self);

Shortcut to set that we should search in all categories

#### Parameters

self | A valid AsSearchQuery |

### as_search_query_set_categories ()

    void
    as_search_query_set_categories (AsSearchQuery *self,
                                    gchar **value);

Set the categories to search

#### Parameters

self | an instance of AsSearchQuery |
value | a null-terminated string array of categories. | [array zero-terminated=1]

### as_search_query_set_categories_from_string ()

    void
    as_search_query_set_categories_from_string
                                   (AsSearchQuery *self,
                                    const gchar *categories_str);

Set the categories list from a string

#### Parameters

self | an instance of AsSearchQuery |
categories_str | Semicolon-separated list of category-names |

### as_search_query_sanitize_search_term ()

    void
    as_search_query_sanitize_search_term (AsSearchQuery *self);

### as_search_query_get_search_term ()

    const gchar *
    as_search_query_get_search_term (AsSearchQuery *self);

#### Parameters

self | an instance of AsSearchQuery |

#### Returns

the search-term we currently use

## Types and Values

## Property Details

### The `“categories”` property

      “categories”               GStrv

categories.

Flags: Read / Write

### The `“search-term”` property

      “search-term”              gchar *

search-term.

Flags: Read / Write

Default value: NULL