1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +02:00

add entries to search index

This commit is contained in:
Harvey Kandola 2017-08-15 19:41:44 +01:00
parent 2c5f73a486
commit 1b96c9093f
15 changed files with 244 additions and 417 deletions

View file

@ -17,15 +17,22 @@ export default Ember.Component.extend({
didReceiveAttrs() {
let docs = this.get('results');
let duped = [];
let phrase = 'Nothing found';
if (docs.length > 0) {
duped = _.uniq(docs, function (item) {
return item.documentId;
});
let references = docs.length === 1 ? "reference" : "references";
let docLabel = duped.length === 1 ? "document" : "documents";
let i = docs.length;
phrase = `${i} ${references}`;
let j = duped.length;
phrase = `${i} ${references} across ${j} ${docLabel}`;
}
this.set('resultPhrase', phrase);
this.set('documents', docs);
this.set('documents', duped);
}
});

View file

@ -17,8 +17,8 @@ export default Ember.Controller.extend({
results: [],
matchDoc: true,
matchContent: true,
matchFile: true,
matchTag: true,
matchFile: false,
matchTag: false,
onKeywordChange: function () {
Ember.run.debounce(this, this.fetch, 750);

View file

@ -12,9 +12,9 @@
<div class="input-control">
{{focus-input type="text" value=filter placeholder='type search phrase'}}
{{#ui/ui-checkbox selected=matchDoc}}document name{{/ui/ui-checkbox}}
{{#ui/ui-checkbox selected=matchContent}}document content{{/ui/ui-checkbox}}
{{#ui/ui-checkbox selected=matchContent}}content{{/ui/ui-checkbox}}
{{#ui/ui-checkbox selected=matchTag}}tag{{/ui/ui-checkbox}}
{{#ui/ui-checkbox selected=matchFile}}attachment name{{/ui/ui-checkbox}}
{{#ui/ui-checkbox selected=matchTag}}tag name{{/ui/ui-checkbox}}
</div>
<div class="examples">
<p>a OR b</p>