mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Tools: Adding debug info to tests
This commit is contained in:
parent
7d2551c9c3
commit
154b3573a4
@ -28,6 +28,7 @@ export default async function(request: Request) {
|
||||
options.caseInsensitive = true;
|
||||
results = await ModelClass.all(options);
|
||||
} else {
|
||||
console.info('routes/search: options:', defaultLoadOptions(request, ModelType.Note));
|
||||
results = await SearchEngineUtils.notesForQuery(query, defaultLoadOptions(request, ModelType.Note));
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,13 @@ class SearchEngineUtils {
|
||||
searchType = SearchEngine.SEARCH_TYPE_BASIC;
|
||||
}
|
||||
|
||||
console.info('SearchEngineUtils: search type', searchType);
|
||||
|
||||
const results = await SearchEngine.instance().search(query, { searchType });
|
||||
const noteIds = results.map(n => n.id);
|
||||
|
||||
console.info('SearchEngineUtils: results', results);
|
||||
|
||||
// We need at least the note ID to be able to sort them below so if not
|
||||
// present in field list, add it.L Also remember it was auto-added so that
|
||||
// it can be removed afterwards.
|
||||
@ -30,8 +34,12 @@ class SearchEngineUtils {
|
||||
conditions: [`id IN ("${noteIds.join('","')}")`],
|
||||
}, options);
|
||||
|
||||
console.info('SearchEngineUtils: previewOptions', previewOptions);
|
||||
|
||||
const notes = await Note.previews(null, previewOptions);
|
||||
|
||||
console.info('SearchEngineUtils: notes', notes);
|
||||
|
||||
// By default, the notes will be returned in reverse order
|
||||
// or maybe random order so sort them here in the correct order
|
||||
// (search engine returns the results in order of relevance).
|
||||
@ -42,6 +50,7 @@ class SearchEngineUtils {
|
||||
if (idWasAutoAdded) delete sortedNotes[idx].id;
|
||||
}
|
||||
|
||||
console.info('SearchEngineUtils: sortedNotes', sortedNotes);
|
||||
|
||||
// Note that when the search engine index is somehow corrupted, it might contain
|
||||
// references to notes that don't exist. Not clear how it can happen, but anyway
|
||||
|
Loading…
Reference in New Issue
Block a user