diff --git a/presentation/maarchRM/Resources/view/archivesPubliques/contentDescription/search.html b/presentation/maarchRM/Resources/view/archivesPubliques/contentDescription/search.html index fc6498233f3f4fd2da3a53a23d8e11352e93bb28..2f2ed0f3bb8706282fef2779be19d0b8bd97b31d 100644 --- a/presentation/maarchRM/Resources/view/archivesPubliques/contentDescription/search.html +++ b/presentation/maarchRM/Resources/view/archivesPubliques/contentDescription/search.html @@ -376,10 +376,9 @@ } var originators = new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace('orgName'), + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('displayName'), queryTokenizer: Bloodhound.tokenizers.whitespace, - prefetch: {url: '/originator', ttl: '0'}, - limit: 100 + prefetch: {url: '/organizations/todisplay?orgUnit=true', ttl: '0'} }); window.localStorage.clear(); @@ -400,7 +399,7 @@ }, { name: 'originators', - displayKey: 'orgName', + displayKey: 'displayName', templates: { empty: function() { return "<span class='well well-sm'>"+$('#noOriginatorFound').html()+"</span>"; @@ -419,9 +418,15 @@ }, source: function(query, cb) { originators.search(query, function(suggestions) { + var i = suggestions.length + while (i--) { + if ($('#orgs').find('[data-orgid="' + suggestions[i].orgId + '"]').length) + suggestions.splice(i, 1); + } cb(suggestions); }); }, + limit: Number.MAX_VALUE, skipCache: true } ).on('typeahead:selected', function($event, suggestion, source) {