prefix match for autocomplete attribute search

This commit is contained in:
zadam
2020-05-21 12:05:12 +02:00
parent 75d8627f1c
commit 2e6395ad88
4 changed files with 29 additions and 12 deletions

View File

@@ -4,13 +4,17 @@ const NoteSet = require('../note_set');
const noteCache = require('../../note_cache/note_cache');
class AttributeExistsExp {
constructor(attributeType, attributeName) {
constructor(attributeType, attributeName, prefixMatch) {
this.attributeType = attributeType;
this.attributeName = attributeName;
this.prefixMatch = prefixMatch;
}
execute(noteSet) {
const attrs = noteCache.findAttributes(this.attributeType, this.attributeName);
const attrs = this.prefixMatch
? noteCache.findAttributesWithPrefix(this.attributeType, this.attributeName)
: noteCache.findAttributes(this.attributeType, this.attributeName);
const resultNoteSet = new NoteSet();
for (const attr of attrs) {