Skip to content

Commit

Permalink
correctly handle facet queries that have no matches
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed May 23, 2012
1 parent 8f2b8c3 commit 3f6916b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/Model/TrackMetaData.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,13 @@ dojo.declare( 'JBrowse.Model.TrackMetaData', null,
dojo.map( dojof.keys( query ), function( facetName ) {
var values = query[facetName];
var items = [];
if( ! this.facetIndexes.byName[facetName] ) {
console.error( "No facet defined with name '"+facetName+"'." );
throw "No facet defined with name '"+facetName+"', faceted search failed.";
}
dojo.forEach( values, function(value) {
items.push.apply( items, this.facetIndexes.byName[facetName].byValue[value].items );
var idx = this.facetIndexes.byName[facetName].byValue[value] || {};
items.push.apply( items, idx.items || [] );
},this);
items.facetName = facetName;
items.sort( dojo.hitch( this, '_itemSortFunc' ));
Expand Down

0 comments on commit 3f6916b

Please sign in to comment.