code: func (q *TagQuery) getMaxTagCount() int {
  	defer q.wg.Done()
  	var maxTagCount int
  
  	if q.tagClause == PREFIX_TAG && len(q.tagPrefix) > 0 {
  		for tag := range q.index {
  			if !strings.HasPrefix(tag, q.tagPrefix) {
  				continue
  			}
  			maxTagCount++
  		}
  	} else if q.tagClause == MATCH_TAG {
  		for tag := range q.index {
  			if q.tagMatch.value.MatchString(tag) {
  				maxTagCount++
  			}
  		}
  	} else {
  		maxTagCount = len(q.index)
  	}
  
  	return maxTagCount
  }
docs: // getMaxTagCount calculates the maximum number of results (cardinality) a
  // tag query could possibly return
  // this is useful because when running a tag query we can abort it as soon as
  // we know that there can't be more tags discovered and added to the result set