|
| 1 | +--- |
| 2 | +title: 'Asterism, the best friend of Lyra' |
| 3 | +date: 2022-11-26T16:00:00.000Z |
| 4 | +description: 'Asterism is a CLI tool that helps you to manage your Lyra instances and searches.' |
| 5 | +tags: |
| 6 | + - javascript |
| 7 | + - lyra |
| 8 | + - search engine |
| 9 | + - asterism |
| 10 | +image: '/images/articles/asterism-the-bf-of-lyra/cover.png' |
| 11 | +author: |
| 12 | + name: Mateo |
| 13 | + image: '/images/profile.jpeg' |
| 14 | +--- |
| 15 | + |
| 16 | +<Image |
| 17 | + src="/images/articles/asterism-the-bf-of-lyra/cover.png" |
| 18 | + width="1280" |
| 19 | + height="720" |
| 20 | + layout="responsive" |
| 21 | + alt="Create your Blog with Next.js and MDX" |
| 22 | + href="/blog/asterism-the-bf-of-lyra" |
| 23 | +/> |
| 24 | + |
| 25 | +Today was released the first stable version of [Asterism](https://github.com/mateonunez/asterism). Asterism provides a CLI to manage your Lyra instances and searches in a simple way. |
| 26 | + |
| 27 | +## What is Lyra? |
| 28 | + |
| 29 | +Lyra is a search engine created by [Michele Riva](https://twitter.com/MicheleRivaCode). Lyra makes **thousands** searches within a few **microseconds** (_μs_) (yes, ms \* 1000). |
| 30 | + |
| 31 | +The main idea of Lyra is to provide a search engine that can be used in all devices that JavaScript can run: web, mobile, desktop, TVs, etc. Everywhere! |
| 32 | + |
| 33 | +## Ok, but what is Asterism? |
| 34 | + |
| 35 | +Asterism is a CLI tool that helps you to convert your database instances (MySQL and PostgreSQL) into Lyra instances and to create searches in a simple way. |
| 36 | + |
| 37 | +## How to install it? |
| 38 | + |
| 39 | +You can install Asterism using `npm|yarn|pnpm`: |
| 40 | + |
| 41 | +```bash |
| 42 | +npm install -g asterism |
| 43 | +``` |
| 44 | + |
| 45 | +## How to use it? |
| 46 | + |
| 47 | +Asterism provides a simple CLI to manage your Lyra instances and searches. |
| 48 | + |
| 49 | +### Create a new Lyra instance |
| 50 | + |
| 51 | +To create a new Lyra instance you can use the `migrate` command: |
| 52 | + |
| 53 | +```bash |
| 54 | +asterism migrate postgres -d postgres -t posts |
| 55 | +``` |
| 56 | + |
| 57 | +This command will create a new Lyra instance from a PostgreSQL table. You can also use the `mysql` option to create a new Lyra instance from a MySQL table. |
| 58 | + |
| 59 | +A new persistent Lyra instance will be created in the provided folder. (default is `/out`). |
| 60 | + |
| 61 | +### Make a search |
| 62 | + |
| 63 | +To make a search you can use the `search` command: |
| 64 | + |
| 65 | +```bash |
| 66 | +asterism search "cool" |
| 67 | +``` |
| 68 | + |
| 69 | +This command will search the provided string in all the Lyra instances and will return the results. |
| 70 | + |
| 71 | +Example: |
| 72 | + |
| 73 | +```bash |
| 74 | +$ asterism search "cool" |
| 75 | + |
| 76 | +[2022-11-26 14:26:49.844] INFO: Resolving asterism. |
| 77 | +[2022-11-26 14:26:50.032] INFO: Searching on asterism. |
| 78 | +[2022-11-26 14:26:50.034] INFO: |
| 79 | + instance_one: { |
| 80 | + "count": 0, |
| 81 | + "elapsed": 225799, |
| 82 | + "hits": [] |
| 83 | + } |
| 84 | + instance_two: { |
| 85 | + "count": 1, |
| 86 | + "elapsed": 931864, |
| 87 | + "hits": [ |
| 88 | + { |
| 89 | + "id": 1, |
| 90 | + "title": "Cool title", |
| 91 | + "content": "Cool content" |
| 92 | + } |
| 93 | + ] |
| 94 | + } |
| 95 | +``` |
| 96 | + |
| 97 | +### Contribute |
| 98 | + |
| 99 | +**Asterism** is an open source project and you can contribute to it. You can find the source code in [GitHub](https://github.com/mateonunez/asterism). |
| 100 | + |
| 101 | +You can also contribute to **Lyra**. You can find the source code in [GitHub](https://github.com/lyrasearch/lyra). |
0 commit comments