forked from geolba/tethys.backend
- added own provider for drive methods
- renamed middleware Role and Can to role_middleware and can_middleware - added some typing for inertia vue3 components - npm updates
This commit is contained in:
parent
cb51a4136f
commit
296c8fd46e
67 changed files with 2515 additions and 1913 deletions
|
@ -9,26 +9,33 @@ import { Client } from '@opensearch-project/opensearch';
|
|||
import { getDomain } from '#app/Utils/utility-functions';
|
||||
import { BaseCommand, flags } from '@adonisjs/core/ace';
|
||||
import { CommandOptions } from '@adonisjs/core/types/ace';
|
||||
import env from '#start/env';
|
||||
// import db from '@adonisjs/lucid/services/db';
|
||||
// import { default as Dataset } from '#app/Models/Dataset';
|
||||
|
||||
const opensearchNode = process.env.OPENSEARCH_HOST || 'localhost';
|
||||
const opensearchNode = env.get('OPENSEARCH_HOST', 'localhost');
|
||||
const client = new Client({ node: `http://${opensearchNode}` }); // replace with your OpenSearch endpoint
|
||||
|
||||
export default class IndexDatasets extends BaseCommand {
|
||||
static commandName = 'index:datasets';
|
||||
static description = 'Index datasets based on publish_id';
|
||||
|
||||
public static needsApplication = true;
|
||||
|
||||
@flags.number({ alias: 'p' })
|
||||
public publish_id: number;
|
||||
|
||||
static options: CommandOptions = {
|
||||
loadApp: true,
|
||||
public static options: CommandOptions = {
|
||||
startApp: true,
|
||||
staysAlive: false,
|
||||
};
|
||||
|
||||
|
||||
async run() {
|
||||
this.logger.info('Hello world!');
|
||||
const { default: Dataset } = await import('#app/Models/Dataset');
|
||||
const datasets = await Dataset.query().where('server_state', 'published').exec(); //this.getDatasets();
|
||||
// const { default: Dataset } = await import('#app/Models/Dataset');
|
||||
// const datasets = await Dataset.query().where('server_state', 'published').exec(); //this.getDatasets();
|
||||
const datasets = await this.getDatasets();
|
||||
const proc = readFileSync('public/assets2/solr.sef.json');
|
||||
const index_name = 'tethys-records';
|
||||
|
||||
|
@ -40,15 +47,19 @@ export default class IndexDatasets extends BaseCommand {
|
|||
}
|
||||
}
|
||||
|
||||
// private async getDatasets(): Promise<any[]> {
|
||||
// // const { default: Dataset } = await import('#app/Models/Dataset');
|
||||
// // const Dataset = (await import('#app/Models/Dataset')).default
|
||||
// const query = Dataset.query().where('server_state', 'published');
|
||||
// if (this.publish_id) {
|
||||
// query.where('publish_id', this.publish_id);
|
||||
// }
|
||||
// return await query;
|
||||
// }
|
||||
private async getDatasets(): Promise<any[]> {
|
||||
// const { default: Dataset } = await import('#app/Models/Dataset');
|
||||
// const Dataset = (await import('#app/Models/Dataset')).default
|
||||
// const Dataset = (
|
||||
// await this.app.container.make('#app/Models/Dataset')
|
||||
// ).default;
|
||||
// const query: ModelQueryBuilder<Dataset, any> = db.from(Dataset);
|
||||
const query = Dataset.query().preload('xmlCache').where('server_state', 'published');
|
||||
if (this.publish_id) {
|
||||
query.where('publish_id', this.publish_id);
|
||||
}
|
||||
return await query.exec();
|
||||
}
|
||||
|
||||
private async indexDocument(dataset: Dataset, index_name: string, proc: Buffer): Promise<void> {
|
||||
try {
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue