2023-11-25 20:00:15 +02:00
# Yo!
2023-11-19 23:00:51 +02:00
2023-11-25 20:00:15 +02:00
Micro Web Crawler in PHP & Manticore
2023-11-24 17:52:13 +02:00
2023-11-25 20:00:15 +02:00
Yo! is the super thin layer for Manticore search server that extends official [manticoresearch-php ](https://github.com/manticoresoftware/manticoresearch-php ) client with CLI tools and simple JS-less WebUI.
2023-11-24 17:52:13 +02:00
2023-11-26 14:19:57 +02:00
## Features
2023-11-24 17:52:13 +02:00
2023-11-26 14:19:57 +02:00
* MIME-based crawler with flexible filter settings by regular expressions, selectors, external links etc
* Page snap history with local and remote mirrors support (including FTP protocol)
* CLI tools for index administration and crontab tasks
2023-11-25 20:00:15 +02:00
* JS-less frontend to run local or public search web portal
2023-11-24 17:52:13 +02:00
* API tools to make search index distributed
2023-11-26 14:19:57 +02:00
## Components
* [Manticore Server ](https://github.com/manticoresoftware/manticoresearch )
2023-11-26 14:24:38 +02:00
* [PHP library for Manticore ](https://github.com/manticoresoftware/manticoresearch-php )
* [Symfony DOM crawler ](https://github.com/symfony/dom-crawler )
* [Symfony CSS selector ](https://github.com/symfony/css-selector )
2023-11-26 14:19:57 +02:00
* [FTP client for snap mirrors ](https://github.com/YGGverse/ftp-php )
2023-11-26 14:24:38 +02:00
* [Hostname ident icons ](https://github.com/dmester/jdenticon-php )
2023-11-26 14:29:20 +02:00
* [Bootstrap icons ](https://icons.getbootstrap.com/ )
2023-11-24 17:52:13 +02:00
2023-11-24 20:00:09 +02:00
### Install
2023-11-30 20:54:04 +02:00
Application require `manticore` , `composer` and `php`
2024-03-21 15:47:41 +02:00
#### Deployment
2023-11-30 20:54:04 +02:00
2024-03-21 15:47:41 +02:00
Project in development, use `dev-main` branch:
* `composer create-project yggverse/yo:dev-main`
2023-11-30 20:54:04 +02:00
#### Development
* `git clone https://github.com/YGGverse/Yo.git`
2024-03-21 15:47:41 +02:00
* `cd Yo`
* `composer update`
* `git checkout -b pr-branch`
2023-11-30 20:54:04 +02:00
#### Init
* `cp example/config.json config.json`
* `php src/cli/index/init.php`
#### Usage
* `php src/cli/document/add.php URL`
* `php src/cli/document/crawl.php`
* `php src/cli/document/search.php '*'`
2023-11-24 22:26:02 +02:00
#### Web UI
1. `cd src/webui`
2. `php -S 127.0.0.1:8080`
2023-11-30 20:54:04 +02:00
3. open `http://127.0.0.1:8080` in browser
2023-11-24 20:03:12 +02:00
## Documentation
2023-11-24 20:00:09 +02:00
2023-11-24 19:55:07 +02:00
### CLI
2023-11-19 23:00:51 +02:00
2023-11-24 19:55:07 +02:00
#### Index
2023-11-19 23:00:51 +02:00
2023-11-24 19:55:07 +02:00
##### Init
2023-11-19 23:00:51 +02:00
Create initial index
```
php src/cli/index/init.php [reset]
```
* `reset` - optional, reset existing index
2024-03-20 21:06:18 +02:00
##### Alter
Change existing index
```
php src/cli/index/alter.php {operation} {column} {type}
```
* `operation` - operation name, supported values: `add` |`drop`
* `column` - target column name
* `type` - target column type, supported values: `text` |`integer`
2023-11-24 19:55:07 +02:00
#### Document
2023-11-19 23:00:51 +02:00
2023-11-24 19:55:07 +02:00
##### Add
2023-11-19 23:00:51 +02:00
```
php src/cli/document/add.php URL
```
* `URL` - add new URL to the crawl queue
2023-11-24 19:55:07 +02:00
##### Crawl
2023-11-19 23:00:51 +02:00
```
php src/cli/document/crawl.php
```
2023-11-27 19:29:17 +02:00
##### Clean
2024-03-21 18:41:33 +02:00
Make index optimization, apply new configuration rules
2023-11-27 19:29:17 +02:00
```
2024-03-21 18:41:33 +02:00
php src/cli/document/clean.php [limit]
2023-11-27 19:29:17 +02:00
```
2024-03-21 18:41:33 +02:00
* `limit` - integer, documents quantity per queue
2023-11-27 19:29:17 +02:00
2023-11-24 19:55:07 +02:00
##### Search
2023-11-19 23:00:51 +02:00
```
php src/cli/document/search.php '@title "*"' [limit]
```
* `query` - required
2023-11-25 04:44:07 +02:00
* `limit` - optional search results limit
##### Migration
###### YGGo
Import index from YGGo database
```
2023-11-25 13:19:34 +02:00
php src/cli/yggo/import.php 'host' 'port' 'user' 'password' 'database' [unique=off] [start=0] [limit=100]
2023-11-25 04:44:07 +02:00
```
Source DB fields required:
* `host`
* `port`
* `user`
* `password`
* `database`
2023-11-25 13:19:34 +02:00
* `unique` - optional, check for unique URL (takes more time)
* `start` - optional, offset to start queue
2023-11-25 13:42:22 +02:00
* `limit` - optional, limit queue
2023-11-30 14:32:55 +02:00
### Backup
#### Logical
2023-11-30 14:33:57 +02:00
SQL text dumps could be useful for public index distribution, but requires more computing resources.
2023-11-30 14:32:55 +02:00
[Read more ](https://manual.manticoresearch.com/Securing_and_compacting_a_table/Backup_and_restore#Backup-and-restore-with-mysqldump )
#### Physical
2023-11-30 14:33:57 +02:00
Better for infrastructure administration and includes original data binaries.
2023-11-30 14:32:55 +02:00
[Read more ](https://manual.manticoresearch.com/Securing_and_compacting_a_table/Backup_and_restore#Using-manticore-backup-command-line-tool )
2023-11-25 13:42:22 +02:00
## Instances
2023-11-30 14:32:55 +02:00
### [Yggdrasil](https://github.com/yggdrasil-network)
2023-11-30 16:18:44 +02:00
* `http://[201:23b4:991a:634d:8359:4521:5576:15b7]/yo/` - IPv6 `0200::/7` addresses only | [index ](http://[201:23b4:991a:634d:8359:4521:5576:15b7]/yo/index.sql )
2023-11-30 14:32:55 +02:00
### [Alfis DNS](https://github.com/Revertron/Alfis)
2023-11-30 16:18:44 +02:00
* `http://yo.ygg` - `.ygg` domain zone search only | [index ](http://yo.ygg/index.sql )
* `http://ygg.yo.index` - alias of `http://yo.ygg` | [index ](http://ygg.yo.index/index.sql )
2023-11-25 13:42:22 +02:00
2023-11-30 14:32:55 +02:00
_*`*.yo.index` reserved for domain-oriented instances e.g. `.btn` , `.conf` , `.mirror` - feel free to request the address_