adobe / helix-shared

Shared libraries for Project Helix.
Apache License 2.0
12 stars 12 forks source link

helix-query.yaml: what would excel support look like? #323

Closed trieloff closed 4 years ago

trieloff commented 4 years ago

See https://github.com/adobe/theblog/blob/f64979fcbb146825c1bb9e55a02567657a94b654/helix-query.yaml

version: 1

indices:
  raw_index:
    source: html
    fetch: https://{repo}-{owner}.project-helix.page/{path}
    include:
      - (en|de|fr)/drafts/migrated/**/*.(md|docx)
      - (en|de|fr)/publish/**/*.(md|docx)
    target: https://adobe.sharepoint.com/:x:/r/sites/TheBlog/Shared%20Documents/theblog/en/query-index.xlsx?d=we7bf6b3af3234076968b30a1565f2373&csf=1&web=1&e=q9o8tW
    sitemap: en/query-index.json
    properties:
    # bla bla
    queries:
      recent:
        query: "*"
        hitsPerPage: 12
        parameters:
          - language
          - context
          - date
        # these don't work
        filters: |
          parents:"${context}${language}" AND date < ${date}
        cache: 600

The index is Excel, but the queries are using the Algolia query language.

How can we make this work?

Option A: Embrace (and extend) the Algolia Query language

We would need a grammar and parser and could then turn the AQAST (Algolia Query AST) into a list of QueryBuilder expressions which helix-data-embed can interpret (or in the future translate into the Excel API for server-side execution).

Downsides:

Option B: Allow QueryBuilder Expressions

The QB format with its key-value pairs lends itself quite well to YAML one we can make some of the idiosyncracies more palpable by turning numbered keys into YAML arrays and conjunction groups into nested keys.

Having Algolia Query language as one output format would be easy to do.

tripodsan commented 4 years ago

is there a formal QB language description somewhere?

trieloff commented 4 years ago

There is comprehensive documentation:

I think the hardest part of the QueryBuilder syntax is ordering/multiple values:

type=cq:Page
1_property=jcr:content/cq:template
1_property.value=/apps/geometrixx/templates/homepage
2_property=jcr:content/jcr:title
2_property.value=English

but in YAML this would become

- type: "cq:Page"
- property: 
    property: "jcr:content/cq:template"
    value: apps/geometrixx/templates/homepage
- property: 
    property: "jcr:content/jcr:title"
    value: English
adobe-bot commented 4 years ago

:tada: This issue has been resolved in version 7.11.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: