mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
server-ts: Port services/search/search_context
This commit is contained in:
parent
1010d11827
commit
fbf77f3382
@ -1,4 +1,4 @@
|
||||
const SearchContext = require('../../src/services/search/search_context.js');
|
||||
const SearchContext = require('../../src/services/search/search_context');
|
||||
const parse = require('../../src/services/search/services/parse.js');
|
||||
|
||||
function tokens(toks, cur = 0) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
const searchService = require('../../src/services/search/services/search.js');
|
||||
const BNote = require('../../src/becca/entities/bnote.js');
|
||||
const BBranch = require('../../src/becca/entities/bbranch.js');
|
||||
const SearchContext = require('../../src/services/search/search_context.js');
|
||||
const SearchContext = require('../../src/services/search/search_context');
|
||||
const dateUtils = require('../../src/services/date_utils');
|
||||
const becca = require('../../src/becca/becca.js');
|
||||
const {NoteBuilder, findNoteByTitle, note} = require('./becca_mocking.js');
|
||||
|
@ -1,7 +1,7 @@
|
||||
const {note} = require('./becca_mocking.js');
|
||||
const ValueExtractor = require('../../src/services/search/value_extractor.js');
|
||||
const becca = require('../../src/becca/becca.js');
|
||||
const SearchContext = require('../../src/services/search/search_context.js');
|
||||
const SearchContext = require('../../src/services/search/search_context');
|
||||
|
||||
const dsc = new SearchContext();
|
||||
|
||||
|
@ -6,7 +6,7 @@ const noteService = require('../services/notes');
|
||||
const TaskContext = require('../services/task_context');
|
||||
const v = require('./validators.js');
|
||||
const searchService = require('../services/search/services/search.js');
|
||||
const SearchContext = require('../services/search/search_context.js');
|
||||
const SearchContext = require('../services/search/search_context');
|
||||
const zipExportService = require('../services/export/zip.js');
|
||||
const zipImportService = require('../services/import/zip.js');
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const becca = require('../../becca/becca');
|
||||
const SearchContext = require('../../services/search/search_context.js');
|
||||
const SearchContext = require('../../services/search/search_context');
|
||||
const searchService = require('../../services/search/services/search.js');
|
||||
const bulkActionService = require('../../services/bulk_actions.js');
|
||||
const cls = require('../../services/cls');
|
||||
|
@ -12,7 +12,7 @@ const xml2js = require('xml2js');
|
||||
const cloningService = require('./cloning.js');
|
||||
const appInfo = require('./app_info');
|
||||
const searchService = require('./search/services/search.js');
|
||||
const SearchContext = require('./search/search_context.js');
|
||||
const SearchContext = require('./search/search_context');
|
||||
const becca = require('../becca/becca');
|
||||
const ws = require('./ws');
|
||||
const SpacedUpdate = require('./spaced_update.js');
|
||||
|
@ -6,7 +6,7 @@ const dateUtils = require('./date_utils');
|
||||
const sql = require('./sql');
|
||||
const protectedSessionService = require('./protected_session');
|
||||
const searchService = require('../services/search/services/search.js');
|
||||
const SearchContext = require('../services/search/search_context.js');
|
||||
const SearchContext = require('../services/search/search_context');
|
||||
const hoistedNoteService = require('./hoisted_note');
|
||||
|
||||
const CALENDAR_ROOT_LABEL = 'calendarRoot';
|
||||
|
@ -1,9 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
const hoistedNoteService = require('../hoisted_note');
|
||||
import hoistedNoteService = require('../hoisted_note');
|
||||
|
||||
interface SearchParams {
|
||||
fastSearch?: boolean;
|
||||
includeArchivedNotes?: boolean;
|
||||
includeHiddenNotes?: boolean;
|
||||
ignoreHoistedNote?: boolean;
|
||||
ancestorNoteId?: string;
|
||||
ancestorDepth?: number;
|
||||
orderBy?: string;
|
||||
orderDirection?: string;
|
||||
limit?: number;
|
||||
debug?: boolean;
|
||||
fuzzyAttributeSearch?: boolean;
|
||||
}
|
||||
|
||||
class SearchContext {
|
||||
constructor(params = {}) {
|
||||
|
||||
fastSearch: boolean;
|
||||
includeArchivedNotes: boolean;
|
||||
includeHiddenNotes: boolean;
|
||||
ignoreHoistedNote: boolean;
|
||||
ancestorNoteId?: string;
|
||||
ancestorDepth?: number;
|
||||
orderBy?: string;
|
||||
orderDirection?: string;
|
||||
limit?: number;
|
||||
debug?: boolean;
|
||||
debugInfo: string | null;
|
||||
fuzzyAttributeSearch: boolean;
|
||||
highlightedTokens: string[];
|
||||
originalQuery: string;
|
||||
fulltextQuery: string;
|
||||
dbLoadNeeded: boolean;
|
||||
private error: string | null;
|
||||
|
||||
constructor(params: SearchParams = {}) {
|
||||
this.fastSearch = !!params.fastSearch;
|
||||
this.includeArchivedNotes = !!params.includeArchivedNotes;
|
||||
this.includeHiddenNotes = !!params.includeHiddenNotes;
|
||||
@ -32,7 +65,7 @@ class SearchContext {
|
||||
this.error = null;
|
||||
}
|
||||
|
||||
addError(error) {
|
||||
addError(error: string) {
|
||||
// we record only the first error, subsequent ones are usually a consequence of the first
|
||||
if (!this.error) {
|
||||
this.error = error;
|
||||
@ -48,4 +81,4 @@ class SearchContext {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SearchContext;
|
||||
export = SearchContext;
|
@ -5,7 +5,7 @@ const lex = require('./lex.js');
|
||||
const handleParens = require('./handle_parens.js');
|
||||
const parse = require('./parse.js');
|
||||
const SearchResult = require('../search_result.js');
|
||||
const SearchContext = require('../search_context.js');
|
||||
const SearchContext = require('../search_context');
|
||||
const becca = require('../../../becca/becca');
|
||||
const beccaService = require('../../../becca/becca_service');
|
||||
const utils = require('../../utils');
|
||||
|
@ -6,7 +6,7 @@ const dateUtils = require('./date_utils');
|
||||
const log = require('./log');
|
||||
const hoistedNoteService = require('./hoisted_note');
|
||||
const searchService = require('./search/services/search.js');
|
||||
const SearchContext = require('./search/search_context.js');
|
||||
const SearchContext = require('./search/search_context');
|
||||
const {LBTPL_NOTE_LAUNCHER, LBTPL_CUSTOM_WIDGET, LBTPL_SPACER, LBTPL_SCRIPT} = require('./hidden_subtree');
|
||||
|
||||
function getInboxNote(date) {
|
||||
|
@ -10,7 +10,7 @@ const contentRenderer = require('./content_renderer.js');
|
||||
const assetPath = require('../services/asset_path');
|
||||
const appPath = require('../services/app_path');
|
||||
const searchService = require('../services/search/services/search.js');
|
||||
const SearchContext = require('../services/search/search_context.js');
|
||||
const SearchContext = require('../services/search/search_context');
|
||||
const log = require('../services/log');
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user