docs/ecmarkup.js
function relevance(result, searchString) {
  var relevance = 0;
  
  relevance = Math.max(0, 8 - result.match.chunks) << 7;
  
  if (result.match.caseMatch) {
    relevance *= 2;
  }
  
  if (result.match.prefix) {
    relevance += 2048
  }
  
  relevance += Math.max(0, 255 - result.entry.key.length);
  
  return relevance;
}
function relevance(result, searchString) {
  var relevance = 0;
  
  relevance = Math.max(0, 8 - result.match.chunks) << 7;
  
  if (result.match.caseMatch) {
    relevance *= 2;
  }
  
  if (result.match.prefix) {
    relevance += 2048
  }
  
  relevance += Math.max(0, 255 - result.entry.key.length);
  
  return relevance;
}
bit 12 - Set if the result starts with searchString bits 8-11: 8 - number of chunks multiplied by 2 if cases match, otherwise 1. bits 1-7: 127 - length of the entry General scheme: prefer case sensitive matches with fewer chunks, and otherwise prefer shorter matches.