code: protected long doCount(String spaceId) throws IOException {
          TopDocs result = getIndexSearcher().search(buildQuery(spaceId, null), 1);
          return result != null ? result.totalHits : -1;
      }
docs: Count number of documents within a space.
  
  @param spaceId
  @return
  @throws IOException