extended search
This commit is contained in:
parent
70befa7c4d
commit
5a4faca86f
@ -182,11 +182,6 @@
|
|||||||
<script>
|
<script>
|
||||||
var isSearchActive = false;
|
var isSearchActive = false;
|
||||||
var tagArray = ["lorem"];
|
var tagArray = ["lorem"];
|
||||||
const dat = [
|
|
||||||
'th',
|
|
||||||
'efi',
|
|
||||||
'wichtig',
|
|
||||||
];
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -211,7 +206,7 @@
|
|||||||
searchtext: "",
|
searchtext: "",
|
||||||
//isSearchActiv: false,
|
//isSearchActiv: false,
|
||||||
selected: [],
|
selected: [],
|
||||||
taglist: dat,
|
taglist: data,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -227,7 +222,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
getFilteredTags(text) {
|
getFilteredTags(text) {
|
||||||
this.taglist = dat.filter((option) => {
|
this.taglist = data.filter((option) => {
|
||||||
return option
|
return option
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
@ -240,6 +235,7 @@
|
|||||||
console.info(tagArray);
|
console.info(tagArray);
|
||||||
},
|
},
|
||||||
search: function() {
|
search: function() {
|
||||||
|
|
||||||
searching(this.searchtext);
|
searching(this.searchtext);
|
||||||
},
|
},
|
||||||
list_messages: function() {
|
list_messages: function() {
|
||||||
@ -252,6 +248,7 @@
|
|||||||
})
|
})
|
||||||
.done(jd => {
|
.done(jd => {
|
||||||
// NICHT SO wg. Vue: _messagelist = jd;
|
// NICHT SO wg. Vue: _messagelist = jd;
|
||||||
|
if(data == ""){
|
||||||
_taglist.splice(0, _taglist.length);
|
_taglist.splice(0, _taglist.length);
|
||||||
_taglist.push.apply(_taglist, jd);
|
_taglist.push.apply(_taglist, jd);
|
||||||
console.log("tag: jd: " + jd);
|
console.log("tag: jd: " + jd);
|
||||||
@ -260,6 +257,7 @@
|
|||||||
get_insert_tag(jd[e]);
|
get_insert_tag(jd[e]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).fail(function(e, f, g) {
|
}).fail(function(e, f, g) {
|
||||||
console.log("err: " + e + f + g);
|
console.log("err: " + e + f + g);
|
||||||
});
|
});
|
||||||
@ -285,7 +283,7 @@
|
|||||||
url: "api/tag/" + id,
|
url: "api/tag/" + id,
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).done(function(tag) {
|
}).done(function(tag) {
|
||||||
dat.push("#" + tag.name);
|
data.push("#" + tag.name);
|
||||||
console.log("it worked!");
|
console.log("it worked!");
|
||||||
}).fail(function(e, f, g) {
|
}).fail(function(e, f, g) {
|
||||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
console.log("cannot load " + id + ".json: " + e + f + g);
|
||||||
@ -300,6 +298,7 @@
|
|||||||
method: "GET"
|
method: "GET"
|
||||||
}).done(jd => {
|
}).done(jd => {
|
||||||
// NICHT SO wg. Vue: _messagelist = jd;
|
// NICHT SO wg. Vue: _messagelist = jd;
|
||||||
|
router.push('/home');
|
||||||
_messagelist.splice(0, _messagelist.length);
|
_messagelist.splice(0, _messagelist.length);
|
||||||
_messagelist.push.apply(_messagelist, jd);
|
_messagelist.push.apply(_messagelist, jd);
|
||||||
//console.log("jd: "+jd);
|
//console.log("jd: "+jd);
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
var tagArray = [];
|
var tagArray = [];
|
||||||
const data=[
|
const data=[];
|
||||||
'th',
|
|
||||||
'efi',
|
|
||||||
'wichtig',
|
|
||||||
];
|
|
||||||
const CreateMsgRouter = {
|
const CreateMsgRouter = {
|
||||||
template: `
|
template: `
|
||||||
<div class="content card om-card">
|
<div class="content card om-card">
|
||||||
@ -90,6 +86,8 @@ const CreateMsgRouter = {
|
|||||||
$.ajax({url: "api/tag/ids",method: "GET"})
|
$.ajax({url: "api/tag/ids",method: "GET"})
|
||||||
.done(jd => {
|
.done(jd => {
|
||||||
// NICHT SO wg. Vue: _messagelist = jd;
|
// NICHT SO wg. Vue: _messagelist = jd;
|
||||||
|
console.log("DATA: "+data);
|
||||||
|
if(data == ""){
|
||||||
_taglist.splice(0, _taglist.length);
|
_taglist.splice(0, _taglist.length);
|
||||||
_taglist.push.apply(_taglist, jd);
|
_taglist.push.apply(_taglist, jd);
|
||||||
console.log("tag: jd: " + jd);
|
console.log("tag: jd: " + jd);
|
||||||
@ -98,13 +96,14 @@ const CreateMsgRouter = {
|
|||||||
get_insert_tag(jd[e]);
|
get_insert_tag(jd[e]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
console.log("err: " + e + f + g);
|
console.log("err: " + e + f + g);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this.list_tags();
|
//this.list_tags();
|
||||||
if ($(this).bootstrapMaterialDesign)
|
if ($(this).bootstrapMaterialDesign)
|
||||||
$(this).bootstrapMaterialDesign();
|
$(this).bootstrapMaterialDesign();
|
||||||
},
|
},
|
||||||
|
@ -2,8 +2,10 @@ var tagArray = [];
|
|||||||
|
|
||||||
const FileRouter = {
|
const FileRouter = {
|
||||||
template: `
|
template: `
|
||||||
<div class="content">
|
<div>
|
||||||
<h4>Erweiterte Suche</h4>
|
<div class="content">
|
||||||
|
<h4 >Erweiterte Suche</h4>
|
||||||
|
</div>
|
||||||
<b-field label="Suche nach">
|
<b-field label="Suche nach">
|
||||||
<b-select
|
<b-select
|
||||||
placeholder="Wähle eine Suchform"
|
placeholder="Wähle eine Suchform"
|
||||||
@ -21,16 +23,16 @@ const FileRouter = {
|
|||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field v-if="selectedOptions=='tags'">
|
<b-field v-if="selectedOptions=='tags'">
|
||||||
<b-autocomplete rounded v-model="searchtext"
|
<b-autocomplete v-model="searchtext"
|
||||||
:data="filteredDataArray"
|
:data="filteredDataArray"
|
||||||
placeholder="suche..." icon="magnify"
|
placeholder="#" icon="label"
|
||||||
@select="option => selected = option">
|
@select="option => selected = option">
|
||||||
</b-autocomplete>
|
</b-autocomplete>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-button type="is-primary" @click="search">SUCHE</b-button>
|
<b-button type="is-primary" @click="search">SUCHE</b-button>
|
||||||
|
|
||||||
<div id="om-msg-cards">
|
<div id="om-msg-cards" v-if="isExtendedSearch==true">
|
||||||
<MsgCard
|
<MsgCard
|
||||||
v-for="id in messagelist.slice().reverse()"
|
v-for="id in messagelist.slice().reverse()"
|
||||||
:key="id"
|
:key="id"
|
||||||
@ -47,6 +49,7 @@ const FileRouter = {
|
|||||||
taglist: data,
|
taglist: data,
|
||||||
messagelist: _messagelist,
|
messagelist: _messagelist,
|
||||||
messages: _messages,
|
messages: _messages,
|
||||||
|
isExtendedSearch: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -63,10 +66,6 @@ const FileRouter = {
|
|||||||
list_messages: function () {
|
list_messages: function () {
|
||||||
messages();
|
messages();
|
||||||
},
|
},
|
||||||
saveTagsToArray: function () {
|
|
||||||
tagArray = this.selected;
|
|
||||||
console.info(tagArray);
|
|
||||||
},
|
|
||||||
getFilteredTags(text) {
|
getFilteredTags(text) {
|
||||||
this.taglist = data.filter((option) => {
|
this.taglist = data.filter((option) => {
|
||||||
return option
|
return option
|
||||||
@ -74,7 +73,6 @@ const FileRouter = {
|
|||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.indexOf(text.toLowerCase()) >= 0
|
.indexOf(text.toLowerCase()) >= 0
|
||||||
})
|
})
|
||||||
this.search();
|
|
||||||
},
|
},
|
||||||
list_tags: function () {
|
list_tags: function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -83,6 +81,7 @@ const FileRouter = {
|
|||||||
})
|
})
|
||||||
.done(jd => {
|
.done(jd => {
|
||||||
// NICHT SO wg. Vue: _messagelist = jd;
|
// NICHT SO wg. Vue: _messagelist = jd;
|
||||||
|
if(data == ""){
|
||||||
_taglist.splice(0, _taglist.length);
|
_taglist.splice(0, _taglist.length);
|
||||||
_taglist.push.apply(_taglist, jd);
|
_taglist.push.apply(_taglist, jd);
|
||||||
console.log("tag: jd: " + jd);
|
console.log("tag: jd: " + jd);
|
||||||
@ -91,6 +90,7 @@ const FileRouter = {
|
|||||||
get_insert_tag(jd[e]);
|
get_insert_tag(jd[e]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
console.log("err: " + e + f + g);
|
console.log("err: " + e + f + g);
|
||||||
});
|
});
|
||||||
@ -101,6 +101,7 @@ const FileRouter = {
|
|||||||
},
|
},
|
||||||
search: function () {
|
search: function () {
|
||||||
searching(this.searchtext);
|
searching(this.searchtext);
|
||||||
|
this.isExtendedSearch=true;
|
||||||
},
|
},
|
||||||
list_messages: function () {
|
list_messages: function () {
|
||||||
messages();
|
messages();
|
||||||
@ -108,7 +109,7 @@ const FileRouter = {
|
|||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
//this.search();
|
//this.search();
|
||||||
this.list_tags();
|
//this.list_tags();
|
||||||
//this.list_messages();
|
//this.list_messages();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -59,7 +59,7 @@ const dbs = {
|
|||||||
get: function(req, res) {
|
get: function(req, res) {
|
||||||
model.Messages.find(
|
model.Messages.find(
|
||||||
{$text: {$search: req.params.phrase}})
|
{$text: {$search: req.params.phrase}})
|
||||||
.sort({tag:1, user:1, message:1, subject:1})
|
.sort({tag:-1})
|
||||||
.exec().then(results => {
|
.exec().then(results => {
|
||||||
//selects id from message:
|
//selects id from message:
|
||||||
var parsed = [];
|
var parsed = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user