## xb-silo-query

xb-silo-query

## Functions

GPtrArray * | xb_silo_query ()
GPtrArray * | xb_silo_query_full ()
GPtrArray * | xb_silo_query_with_context ()
XbNode * | xb_silo_query_first ()
XbNode * | xb_silo_query_first_full ()
XbNode * | xb_silo_query_first_with_context ()
gboolean | xb_silo_query_build_index ()

## Description

## Functions

### xb_silo_query ()

    GPtrArray *
    xb_silo_query (XbSilo *self,
                   const gchar *xpath,
                   guint limit,
                   GError **error);

Searches the silo using an XPath query, returning up to `limit` results.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbSilo |
xpath | an XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
limit | maximum number of results to return, or 0 for "all" |
error | the GError, or `NULL` |

#### Returns

results, or `NULL` if unfound.

[transfer container][element-type XbNode]

Since: 0.1.0

### xb_silo_query_full ()

    GPtrArray *
    xb_silo_query_full (XbSilo *self,
                        XbQuery *query,
                        GError **error);

Searches the silo using an XPath query.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbSilo |
query | an XbQuery |
error | the GError, or `NULL` |

#### Returns

results, or `NULL` if unfound.

[transfer container][element-type XbNode]

Since: 0.1.13

### xb_silo_query_with_context ()

    GPtrArray *
    xb_silo_query_with_context (XbSilo *self,
                                XbQuery *query,
                                XbQueryContext *context,
                                GError **error);

Searches the silo using an XPath query.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbSilo |
query | an XbQuery |
context | context including values bound to opcodes of type `XB_OPCODE_KIND_BOUND_INTEGER` or `XB_OPCODE_KIND_BOUND_TEXT`, or `NULL` if the query doesn’t need any context. | [nullable][transfer none]
error | the GError, or `NULL` |

#### Returns

results, or `NULL` if unfound.

[transfer container][element-type XbNode]

Since: 0.3.0

### xb_silo_query_first ()

    XbNode *
    xb_silo_query_first (XbSilo *self,
                         const gchar *xpath,
                         GError **error);

Searches the silo using an XPath query, returning up to one result.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a tiny subset of XPath 1.0 is supported.

#### Parameters

self | a XbSilo |
xpath | An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
error | the GError, or `NULL` |

#### Returns

a XbNode, or `NULL` if unfound.

[transfer full]

Since: 0.1.0

### xb_silo_query_first_full ()

    XbNode *
    xb_silo_query_first_full (XbSilo *self,
                              XbQuery *query,
                              GError **error);

Searches the silo using an XPath query, returning up to one result.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a tiny subset of XPath 1.0 is supported.

#### Parameters

self | a XbSilo |
query | an XbQuery |
error | the GError, or `NULL` |

#### Returns

a XbNode, or `NULL` if unfound.

[transfer full]

Since: 0.1.13

### xb_silo_query_first_with_context ()

    XbNode *
    xb_silo_query_first_with_context (XbSilo *self,
                                      XbQuery *query,
                                      XbQueryContext *context,
                                      GError **error);

Searches the silo using an XPath query, returning up to one result.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a tiny subset of XPath 1.0 is supported.

#### Parameters

self | a XbSilo |
query | an XbQuery |
context | context including values bound to opcodes of type `XB_OPCODE_KIND_BOUND_INTEGER` or `XB_OPCODE_KIND_BOUND_TEXT`, or `NULL` if the query doesn’t need any context. | [nullable][transfer none]
error | the GError, or `NULL` |

#### Returns

a XbNode, or `NULL` if unfound.

[transfer full]

Since: 0.3.0

### xb_silo_query_build_index ()

    gboolean
    xb_silo_query_build_index (XbSilo *self,
                               const gchar *xpath,
                               const gchar *attr,
                               GError **error);

Adds the ``attr()`` or ``text()`` results of a query to the index.

#### Parameters

self | a XbSilo |
xpath | An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
attr | Attribute name, e.g. `type`, or NULL. | [nullable]
error | the GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.4