From 24fe671df51e3fcf55f9be50935fb2dce0e8a84d Mon Sep 17 00:00:00 2001
From: Tim Repke <repke@mcc-berlin.net>
Date: Thu, 10 Aug 2023 19:30:22 +0200
Subject: [PATCH] expose NQL grammar

---
 server/api/routes/search.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/server/api/routes/search.py b/server/api/routes/search.py
index a643575..257f1cd 100644
--- a/server/api/routes/search.py
+++ b/server/api/routes/search.py
@@ -1,4 +1,5 @@
 import httpx
+from nacsos_data.db.crud.items.query.parse import GRAMMAR
 from pydantic import BaseModel
 from fastapi import APIRouter, Depends
 import sqlalchemy.sql.functions as func
@@ -79,6 +80,11 @@ async def term_expansion(term_prefix: str,
         ]
 
 
+@router.get('/nql/grammar', response_model=str)
+async def nql_grammar() -> str:
+    return GRAMMAR
+
+
 class QueryResult(BaseModel):
     n_docs: int
     docs: list[AcademicItemModel]
-- 
GitLab