File: README.md

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (30 lines) | stat: -rw-r--r-- 2,568 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Chrome OS Local Search Service

`LocalSearchService` provides on-device data storage/indexing and flexible search functions via approximate string matching. It supports both in-process and out-of-process clients with the use of a mojo wrapper.

## `Index`
`LocalSearchService` owns one or more `Index`'s, which implement data indexing and search. A client can request to have its own `Index`. Before a client can start using its `Index`, we will need to add a new `IndexId` that will be used by the client as a key when requesting an `Index` via `LocalSearchService::GetIndex`.

### Supported backends
An `Index` could use one of the two backends for storage/indexing and search: linear map (`Backend::kLinearMap`) and inverted index (`Backend::kInvertedIndex`). A client can specify which backend to use by adding a `Backend` parameter to `LocalSearchService::GetIndex`. This is an optional parameter and defaults to `Backend::kLinearMap` if not specified.

If a client's corpus is relatively small, e.g. hundreds of documents and each document contains a few keywords then a linear map should suffice. If the corpus is large and each document is a full article, then an inverted index would be more appropriate: it will parse documents, (optionally) remove stopwords and rank documents via TF-IDF.

### Search parameters

A client can configure `SearchParams` of its `Index`, but this is not necessary because default parameters have been set to optimal values. We suggest you reach out to us before changing the parameters.

## How to use
### In-process clients
An `Index` can be requested as follows
1. Call `LocalSearchServiceFactory::GetForProfile` to obtain a `LocalSearchService` pointer.
2. Call `LocalSearchService::GetIndex` via the pointer above to obtain an `Index` pointer.

Subsequently the client can start adding/updating/deleting data and search. For details, please see `index.h` for all functions and return results.

### Out-of-process clients
If a client is running out-of-process, the client will need to
1. Set up a remote to `mojom::LocalSearchServiceProxy`, have the receiving end bound to its implementation via `LocalSearchServiceProxyFactory::GetForProfile(profile)->BindReceiver`.
2. Set up a remote to `mojom::IndexProxy`, have the receiving end bound to its implementation via `mojom::LocalSearchServiceProxy::GetIndex`.

Functions will be similar to their in-process counterparts, except the calls now will be asynchronous and results will be returned via callbacks. For details, please see `proxy/local_search_service_proxy.mojom`'