ash_hq/README.md

21 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2022-03-21 17:43:24 +13:00
# AshHq
## Getting Started
2022-03-21 17:43:24 +13:00
1. Fork and clone this repository.
2022-09-16 10:35:33 +12:00
2. Set up the project by running `mix do deps.get, deps.compile, setup`
3. Run `mix import` to import the latest dependencies from hex (this may take a while)
4. Install the frontend assets by running `npm i --prefix assets`.
5. Run the server with `iex -S mix phx.server`
6. Open [http://localhost:4000](http://localhost:4000)
2022-03-21 17:43:24 +13:00
Note to linux users: You will need the following packages (or their equivalents) to compile successfully: `erlang-dev erlang-parsetools erlang-os-mon erlang-xmerl erlang-tools`
## A Bit of History
2023-02-05 01:44:51 +13:00
The docs are _not_ static content like you would typically see for documentation. They are all stored in a database, because they can all be full-text searched using postgres. Eventually it would make sense to serve the individual doc pages from a CDN or something like that. The interesting pages in that regard is the `Docs` page. We do quite a bit of work to make sure that we are only loading the html that will be served for the exact document we are seeing.
2022-03-21 17:43:24 +13:00
2022-08-18 14:07:54 +12:00
The magic of search is done via `AshHq.Docs.Extensions.Search`, which modifies resources to make them full text searchable using postgres, amongst other things. See `lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex` for more.
2022-03-21 17:43:24 +13:00
2022-08-18 14:07:54 +12:00
There is also a usage of `Ash.Flow` for searching, which can be found in `lib/ash_hq/docs/search/search.ex`. It is actually a bit un-ideal, as the better thing to do would be to use a postgres UNION. There are ways to do that with Ash by extracting the resource queries and then making a union, but it was much easier to just put a search action in a flow. Eventually, Ash will support unions.