/*global define */ define(['jquery', 'underscore', 'backbone', 'models/SolrHeader', 'models/SolrResult', 'models/LogsSearch'], function($, _, Backbone, SolrHeader, SolrResult, LogsSearch) { 'use strict'; // SolrResults Collection // ------------------------ // The collection of SolrResult var SolrResultList = Backbone.Collection.extend({ // Reference to this collection's model. model: SolrResult, initialize: function(models, options) { this.docsCache = options.docsCache || null; this.currentquery = options.query || '*:*'; this.fields = options.fields || "id,title"; this.rows = options.rows || 25; this.start = options.start || 0; this.sort = options.sort || 'dateUploaded+desc'; this.facet = options.facet || []; this.facetCounts = "nothing"; this.stats = options.stats || false; this.minYear = options.minYear || 1900; this.maxYear = options.maxYear || new Date().getFullYear(); //Turn on/off the feature to search the logs when retrieving SolrResults this.searchLogs = (typeof options.searchLogs == "undefined")? true : options.searchLogs; if(appModel.get("d1LogServiceUrl") && this.searchLogs){ this.logsSearch = options.logsSearch || new LogsSearch(); this.on("reset", this.getLogs); } }, url: function() { //Convert facet keywords to a string var facetFields = ""; for (var i=0; i 0) { facetFields += "&facet.mincount=1"; // only facets meeting the current search facetFields += "&facet.limit=-1"; // CAREFUL: -1 means no limit on the number of facets } //Do we need stats? if (!this.stats){ var stats = ""; } else{ var stats = "&stats=true"; for(var i=0; i