Skip to content
Snippets Groups Projects
Commit d1518d22 authored by Martyn Welch's avatar Martyn Welch Committed by Emanuele Aina
Browse files

Remove contact search doc


The search mechanism documented here currently doesn't work:

user@apertis:~$ folks-inspect search foo

(folks-inspect:13376): folks-WARNING **: 01:48:07.385: backend-store.vala:434: Error preparing Backend 'telepathy': The name org.freedesktop.Telepathy.AccountManager was not provided by any .service files

This functionality is currently not a priority, drop the documentation
since it doesn't work.

Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
parent ea719502
No related branches found
No related tags found
1 merge request!39Wip/martyn/website updates
+++
date = "2014-12-17"
weight = 100
title = "Contacts Search"
aliases = [
"/old-wiki/Docs/contacts-search"
]
+++
# Contacts search
This allows to search for fields of contacts, and to get the results of
the search sorted by full name if desired.
## Basic explanation
- **Query** contains basic definitions (constants, etc.)
- **SimpleQuery** contains the search definitions (the query token and
fields to match)
- **SearchView** provides the means to retrieve the search results
(using the query defined in SimpleQuery)
- **individuals** returns a Map with the unsorted map of
\<Individual.id, Individual\> returned by the search
- **sorted_individuals** returns a sorted List of Individuals
- For a paged, sorted list, call **get_sorted_page(int
page_size, int page_num)**
## Folks-inspect option
A basic search option has been added to folks-inspect. It will search
the name fields of contacts and output the matching contacts.
Usage:
`folks-inspect search [string]`
## Example
Here is a basic example, extracted from folks-inspect tool
` using Folks;`
` using Gee;`
` using GLib;`
` private class Folks.Inspect.Commands.Search : Folks.Inspect.Command`
` {`
` public Search (Client client)`
` {`
` base (client);`
` }`
` `
` public override async void run (string? command_string)`
` {`
` if (command_string == null)`
` {`
` /* A search string is required */`
` Utils.print_line ("Please enter a search string");`
` }`
` else`
` {`
` var query = new SimpleQuery (`
` command_string, Query.MATCH_FIELDS_NAMES);`
` var search_view = new SearchView (this.client.aggregator, query);`
` try`
` {`
` yield search_view.prepare ();`
` }`
` catch (GLib.Error e)`
` {`
` GLib.warning ("Error when calling prepare: %s\n", e.message);`
` } `
` foreach (var individual in search_view.individuals.values)`
` Utils.print_individual (individual, true);`
` }`
` }`
` }`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment