# App/Search

From XOWA: the free, open-source, offline wiki application

XOWA can search for a page by title

## Search by page title

XOWA can find a page by words in its title. For example, typing `earth` will pull up all titles with the word, including Earth and History of Earth. More complicated searches can be performed, such as `earth + (history, future) -middle`

XOWA currently cannot search by text within a page (full-text search). This will be added in a future version.

## Usage

There are three ways to use search:

- Type into the address bar. A list of suggestions appear underneath.
- Type into the suggest box. A list of suggestions appear underneath. Note that this box is near the top-right hand corner of the page between "View HTML" and the magnifying glass icon.
- Type "?:some word" into the address bar. For example, enter `?:earth` in the address bar when in Simple Wikipedia

## Syntax

The following syntax is supported for search text:

name | description | symbol | example | finds | skips
--- | --- | --- | --- | --- | ---
single word | finds pages which start with this word (automatic wildcard at the end) |  | `earth` | Earth History of Earth Earthquake |
single word with space | finds pages which have this word exactly (no automatic wildcard) |  | `earth` | Earth History of Earth | Earthquake
multiple words | finds pages which have all these words |  | `earth history` | History of Earth Earth history | Earth
wildcard | finds pages which start with these letters | `*` | `earth*` | Earth History of Earth Earthquake |
| finds pages which end with these letters | `*` | `*earth` | Earth History of Earth Earthquake Hearth |
| finds pages which start / end with these letters | `*` | `e*h` | Earth History of Earth Earthquake English language |
not | skips pages which have this word | `-` | `earth -history` | Earth | History of Earth
or | includes pages which have this word | `,` | `earth, history` | History of Earth Earth history History Earth
and | requires pages to have this word | `+` | `earth + history` | History of Earth Earth history | History Earth
quote | requires pages to have this exact text | `"` | `"earth history"` | Earth history | History of Earth History Earth
parentheses | allows complicated and / or grouping | `(` `)` | `earth + (history, future)` | History of Earth Future of Earth | Earth
escape | allows searching for any symbols above | `\` | `c\+\+` | C++

### General

- Spaces are ignored
  - `earth, history` is the same as `earth , history` or `earth ,history`
- Incorrect terms are auto-corrected as per the following:
  - `earth - history` is the same as `earth history`
  - `earth +` is the same as `earth`
  - `earth,` is the same as `earth`
  - `"earth` is the same as `"earth"`. Note that `"earth history` becomes `"earth" history`.
  - `(earth` is the same as `earth`
  - `c\` is the same as `c`

### Wildcard

- Wildcards are automatically added to the last word. For example, `earth histor` is the same as `earth histor*`.
- Wildcards will be slower than non-wildcarded versions. In terms of performance, they are ranked as following:
  - end of word
    - faster, especially when word is longer. EX: `abcdefghi*` vs `a*`
    - may be slow for certain multi-word queries. EX: `page meg*`
    - uses the `>=` `<` operators: `word_text >= ? AND word_text < ?`
    - uses an INDEX scan
  - beginning of word / middle of word
    - may be fast if matching a common string. EX: `*a`, `*arth`
    - will be slow for queries that don't match results. EX: `ea*rh`
    - uses the LIKE operator: `word_text LIKE ? ESCAPE '|'`
    - uses a TABLE scan

### Not

- `-` only works at the start of the word
  - `earth hi-story` is the same as `earth "hi-story"`. In other words, the `-` is literal
- `-` must be used with a word. Entering just `-QXZ` will return 0 results

### Quote

- Quotes can also be used for escaping. For example `"c++"` is the same as `c\+\+`
- Quotes must be doubled up inside quotes. For example `"a""b"` means search for a word with `a"b`

## Sorting

By default, XOWA returns results sorted by "page length descending". In other words, the largest page would be the first in the list and the smallest page would be the last.

If a wiki is built with PageRank, or if a wiki is downloaded from archive.org, then the results will be sorted by "PageRank descending". See Options/Search for enabling PageRank.

## Background database search

By default, XOWA runs database searches in the background. This will return results to the screen quickly for complicated searches. For example, consider a search for `Earth*`:

- When the search runs in the background, the first result shows up in 2 seconds, and more results show up every second afterwards. The search will complete in 5 seconds.
- When the search does not run in the background, all the results show up at the 5 second mark.

While a search is running in the background, there will be a link called `Stop searching`. Clicking on the link will stop the background search, though the current results may be incomplete.

Finally, all search results are cached. The first time you search for `Earth*`, XOWA will search the database. Every time afterwards, it will pull the results up from memory. If you restart XOWA, it will search the database again.

## Database update

XOWA wikis created before v3.3.4.1 will need to be upgraded. XOWA will detect if an upgrade is needed, and show a message box for confirmation. The upgrade process will take a few minutes.

Note that new wikis created after v3.3.4.1 will automatically be in the new format.

## Options

There are 2 pages for configuring Search

- Configure PageRank: See Options/Search
- Configure Address bar autocomplete: See Options/Search_suggest

### XOWA

- Main page
- Screenshots
- Video
- Download XOWA
- Download wikis

### Getting started

- Requirements
- Installation
- Simple Wikipedia
- English Wikipedia
- Other Wikipedias

### Android

- Setup
- Video

### Help

- About
- Contents
- Media
- Feedback

### Blog

- Current

### Links

- Wikimedia dumps
- XOWA @ archive.org
- English Wikipedia

### Donate

- archive.org
- Wikipedia