fix basic query
This commit is contained in:
parent
e360ee1557
commit
502edd8263
2 changed files with 22 additions and 7 deletions
|
|
@ -7,7 +7,7 @@ import fs from 'fs';
|
||||||
import { Lemma, WordForm, Lect } from "./db/dbmodel.js";
|
import { Lemma, WordForm, Lect } from "./db/dbmodel.js";
|
||||||
import "@total-typescript/ts-reset";
|
import "@total-typescript/ts-reset";
|
||||||
import {
|
import {
|
||||||
Like
|
Like, In
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
|
|
||||||
const RELOAD_SHEET_ON_START = false;
|
const RELOAD_SHEET_ON_START = false;
|
||||||
|
|
@ -45,10 +45,15 @@ function initExpress() {
|
||||||
|
|
||||||
const word_forms: WordForm[] = await WordForm.find({
|
const word_forms: WordForm[] = await WordForm.find({
|
||||||
where:{word_form: Like(`%${search_term}%`)},
|
where:{word_form: Like(`%${search_term}%`)},
|
||||||
relations: { lemma: { word_forms: { lect: true }} }
|
relations: { lemma: true }
|
||||||
});
|
});
|
||||||
|
|
||||||
const lemmas = word_forms.map(w=>w.lemma);
|
let lemma_ids = word_forms.map(w=>w.lemma.lemma_name);
|
||||||
|
|
||||||
|
const lemmas: Lemma[] = await Lemma.find({
|
||||||
|
where: { lemma_name: In(lemma_ids)},
|
||||||
|
relations: { word_forms: { lect: true }}
|
||||||
|
})
|
||||||
|
|
||||||
res.status(200).send({
|
res.status(200).send({
|
||||||
terms: lemmas.length,
|
terms: lemmas.length,
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,23 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="section container">
|
<section class="section container">
|
||||||
<p class="notification">
|
<div class="notification is-info block">
|
||||||
⚠ Under construction :3 ⚠
|
<p>To searcn tropos-agnostically, enter a term below.</p>
|
||||||
</p>
|
</div>
|
||||||
|
|
||||||
|
<div class="block is-flex is-flex-direction-row is-gap-2">
|
||||||
|
<input class="input" type="text"></input>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue