docs icon indicating copy to clipboard operation
docs copied to clipboard

Document title typeahead results

Open terba opened this issue 1 year ago • 0 comments

The results for the document title typeahead search are most of the time not what I was expecting. So I changed the sort order to descending, the sort column to 3 and the limit to 10 in DocumentEdit.js. It is much better now, as it offers the latest documents matching the typed text.

  /**
   * Returns a promise for typeahead title.
   */
  $scope.getTitleTypeahead = function($viewValue) {
    var deferred = $q.defer();
    Restangular.one('document/list')
    .get({
      limit: 10,
      sort_column: 3,
      asc: false,
      search: $viewValue
    }).then(function(data) {
      deferred.resolve(_.uniq(_.pluck(data.documents, 'title'), true));
    });
    return deferred.promise;
  };

terba avatar Jan 04 '24 21:01 terba