Commit Graph
23 Commits
Author SHA1 Message Date
Matouš Jan FialkaandGitHub fea7e5a508 Merge branch 'main' into liq-implement-offset 2026-03-11 18:49:29 +01:00
Matouš Jan Fialka 9522437941 [LIQ] Website: Improve general syntax description
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-11 15:17:06 +01:00
Matouš Jan Fialka 0efbe59c8c [LIQ] Implement offset (3: update docs)
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-11 11:36:04 +01:00
Matouš Jan Fialka bc5c3c8bda [LIQ] Implement intra-aggregate order by (5: documentation)
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-11 08:52:33 +01:00
Zef HemelandGitHub 5ece01147a Merge pull request #1867 from mjf/space-lua-liq-add-order-by-using
[Space Lua] LIQ: Add `using ...` support to `order by`
2026-03-04 14:35:00 +01:00
Zef Hemel 59c271131b Big website content iteration 2026-03-04 13:31:27 +01:00
Matouš Jan Fialka a1024212ee [LIQ] order by: Replace Quicksort with merge sort with SWO violation detection
- Add iterative async stable merge sort (*O(n log n)*).
- Replace Quicksort with the new merge sort (kept Quicksort for tables).
- Update documentation (reorganize for logical flow, add SWO section
  with invalid comparator example that really throws).

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-04 09:06:11 +01:00
Matouš Jan Fialka 01dd7c1db4 [Space Lua] LIQ: Add using ... support to order by
* support for custom comparators in LIQ `order by` clauses via the
  `using` keyword.

* `using` is mutually exclusive with `asc`/`desc` and accepts either
  a *named function* or an *inline anonymous function*. The comparator
  receives two values and returns true if the first should come before the
  second.

* `nulls first`/ `nulls last` works independently of `using`.

* `using` is now a reserved keyword (`kw`; this cannot be avoided but
  the chance to collide with user scripts is negligable),

* documentation updated + polished a little

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-03 14:47:28 +01:00
Matouš Jan Fialka ff6854f6ee [LIQ] Add nulls first / nulls last to order by
Extend the `order by` clause with optional `nulls first` and `nulls
last` modifiers following standard SQL semantics. Each sort key can
independently specify where `nil` values should appear in the result. By
default, ascending sorts place nulls last and descending sorts place
nulls first. An explicit nulls first or nulls last overrides this
default. The `asc` keyword is also now accepted as an explicit
alternative to the default ascending direction. Documentation and tests
were updated accordingly.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-02 12:34:25 +01:00
Matouš Jan Fialka b6d4f71aca [LIQ/doc] Fix docs typo
The `select` part operates not over a single record, but over each group
(i.e., the set of records sharing the same group key). The `select`
clause's environment is generally:

* `name` (the group key)

* `group` (the table of records in the group)

Note: no `p` is bound (`p` is not set; it was the row variable during scan, but we are now at the group level).

In the `select { name = name }` the name refers to the group key (what
we `group by`-ed).

We typically use:

* `name = name` (group key, as in the query), or

* if we want data from the first record (say all grouped `p.name` are
  the same and non-`nil`) then `name = group[1].name`.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-02-25 10:45:08 +01:00
13c61ebab7 [LIQ] Extend with group by and having with aggregators (#1843)
* [LIQ] Extend with `group by` and `having` support

Also update documentation with extensive examples and add some parser
tests.

Note: `make generate` JS files included.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Merge `liq-add-support-for-aggregators` branch

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Fix link, remove `_` example

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Wrap example LIQ queries inside `query [[ .. ]]` and replace `sql` code block type to `lua`

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Example self-consistency fix

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Fixed some queries

* Add experimental tags to LIQ aggregation/grouping

---------

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
Co-authored-by: Zef Hemel <zef@zef.me>
2026-02-25 10:35:31 +01:00
Zef Hemel 77b3186160 Revert from t in expr syntax variant in LIQ after discussion 2026-01-27 16:24:29 +01:00
Zef Hemel 812dee8537 Lua/LIQ: added from p in <<expr>> as a syntax variant (and preferred
option) for `from p = <<expr>>`. Updated docs accordingly.
2026-01-27 09:15:07 +01:00
Zef Hemel 7c6becc7db Fix link to query templates in website 2025-10-29 09:50:22 +01:00
Amanda StjernaandGitHub 7b7e905790 LIQ: add mention of rendering links (#1578) 2025-10-01 13:19:11 +02:00
Marek S. ŁukasiewiczandGitHub f2f4937854 Utility function to handle empty query results and templates (#1386)
* Add global Lua function 'some'

Moved documentation for 'each' function to non-standard section.

* Revert "Add optional argument to template.each for empty collection output (#1359)"

This reverts commit b73dadec67.

* Reimplement #1359 using 'some' function
2025-05-12 07:33:49 +02:00
Marek S. ŁukasiewiczandGitHub 10e7cea08d Order strings in queries using collation algorithm (#1391)
Configurable with queryCollation, default value maintains old behaviour.
Added tests, schema, example settings, and documentation to query page.

Close: #614
Close: #1316
2025-05-10 17:06:45 +02:00
Marek S. ŁukasiewiczandGitHub 39be21e475 Mention answers to recent forum questions on website (#1358)
* Add another example line to Frontmatter.md

Add another line which shows that page references should be quoted and pascalCase convention

* Mention feather icons in config documentation

* Add a query example to select based on folder

This is relevant for Quick Notes
2025-04-30 11:02:13 +02:00
Zef Hemel e1a6643d9a Website documentation work 2025-04-06 21:49:15 +02:00
Zef Hemel 6078452a6c Breaking Lua API changes:
* tpl -> template.new
* define_command -> command.define
* define_event_listener -> event.listen
* tag -> index.tag

Updated in the docs
2025-01-19 14:32:11 +01:00
Zef Hemel 5604f6d8c2 Lua: tweaks and docs 2025-01-14 20:26:47 +01:00
Zef Hemel cbf227fa49 Lua Queries: make object attributes variables 2025-01-13 21:17:08 +01:00
Zef Hemel bf6a34f82c Lua Integrated Query 2025-01-13 20:25:39 +01:00