Skip to content

Commit

Permalink
Add public static site and docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jun 18, 2022
1 parent eca69dd commit 3410afc
Show file tree
Hide file tree
Showing 19 changed files with 619 additions and 94 deletions.
1 change: 1 addition & 0 deletions docs/documentation/docs/api/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API docs are to-do.
38 changes: 38 additions & 0 deletions docs/documentation/docs/data-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Data structure

dictpress is language agnostic and has no concept of language semantics. It stores all data in a Postgres database in just two tables entries and relations. To make a universal dictionary interface possible, it treats all dictionary entries as UTF-8 strings that can be accurately searched with Postgres DB's fulltext capabilities by storing tsvector tokens alongside them. The tokens that encode and make the entries searchable can be anything—simple stemmed words or phonetic hashes like Metaphone.

Postgres comes with built-in tokenizers for two dozen languages (\dFd to see the full list on psql).

- There can be any number of languages defined in the dictionary. eg: 'english', 'malayalam', 'kannada' etc.
- All content, the entry words and their definitions, are stored in the `entries` table
- Entry-definition many-to-many relationships are stored in the `relations` table, represented by `from_id` (entry word) -> `to_id` (definition word), where both IDs refer to the `entries` table.

## Database tables

### entries
| Field | Type | |
|-----------|------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `id` | `SERIAL` | Automtaically generated numeric ID used internally |
| `guid` | `TEXT` | Automtaically generated unique id (UUID) used in public facing APIs |
| `content` | `TEXT` | Actual language content. Dictionary word or definition entries |
| `initial` | `TEXT` | The first "alphabet" of the content. For English, for the word `Apple`, the initial is `A` |
| `weight` | `INT` | An optional numeric value to sort search results in ascending order |
| `tokens` | `TSVECTOR` | Fulltext search tokens. For English, Postgres' built-in tokenizer gives `to_tsvector('fully conditioned')` = `'condit':2 'fulli':1` |
| `types` | `TEXT[]` | Types of content as defined in the content. Eg `{noun, propernoun}` |
| `tags` | `TEXT[]` | Optional tags |
| `phones` | `TEXT[]` | Phonetic (pronunciation) descriptions of the content. Eg: `{ap(ə)l, aapl}` for `Apple` |
| `notes` | `TEXT` | Optional additional textual description of the content. |
| `status` | `ENUM` | `enabled` (show the entry in search results), `disabled` (hide from search results), `pending` (public submission pending moderator review)|


### relations
| Field | Type | |
|-----------|----------|------------------------------------------------------------------------|
| `from_id` | `INT` | ID of the head word or the dictionary entry in the entries table |
| `to_id` | `INT` | ID of the definition content in the entry table |
| `types` | `TEXT[]` | Types defining the definition as defined in the config. Eg `{noun, propernoun}` |
| `weight` | `INT` | An optional numeric value to order definition results |
| `tags` | `TEXT[]` | Optional tags |
| `status` | `ENUM` | `enabled` (show the entry in search results), `disabled` (hide from search results), `pending` (public submission pending moderator review)|
| `notes` | `TEXT` | Optional additional textual description of the content. |
Binary file added docs/documentation/docs/images/admin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/documentation/docs/images/demo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/documentation/docs/images/favicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
140 changes: 140 additions & 0 deletions docs/documentation/docs/images/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/documentation/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[![dictpress](images/logo.svg)](https://listmonk.app)

dictpress is a free and open source, single binary webserver application for building and publishing fast, searchable, dictionaries for any language.

<br /><br />
![dictpress screenshot](images/demo.png)
18 changes: 18 additions & 0 deletions docs/documentation/docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Installation

dictpress requires Postgres ⩾ v10.

## Binary
- Download the [latest release](https://github.com/knadh/dictpress/releases) and extract the binary.
- `./dictpress --new-config` to generate config.toml. Then, edit the file.
- `./dictpress --install` to setup the Postgres DB.
- Run `./dictpress` and visit `http://localhost:9000/admin`.


## Compiling from source

To compile the latest unreleased version (`master` branch):

1. Make sure `go`, `nodejs`, and `yarn` are installed on your system.
2. `git clone git@github.com:knadh/dictpress.git`
3. `cd dictpress && make dist`. This will generate the `dictpress` binary.

0 comments on commit 3410afc

Please sign in to comment.