code: private static Map<GroupHit, Spans> collectSpansForOccurences(
        Set<GroupHit> occurences, Set<String> prefixes, String field,
        IndexSearcher searcher, LeafReaderContext lrc) throws IOException {
      Map<GroupHit, Spans> list = new HashMap<>();
      IndexReader reader = searcher.getIndexReader();
      final float boost = 0;
      for (GroupHit hit : occurences) {
        MtasSpanQuery queryHit = createQueryFromGroupHit(prefixes, field, hit);
        if (queryHit != null) {
          MtasSpanQuery queryHitRewritten = queryHit.rewrite(reader);
          SpanWeight weight = queryHitRewritten.createWeight(searcher, false,
              boost);
          Spans spans = weight.getSpans(lrc, SpanWeight.Postings.POSITIONS);
          if (spans != null) {
            list.put(hit, spans);
          }
        }
      }
      return list;
    }
docs: Collect spans for occurences.
  
  @param occurences
  the occurences
  @param prefixes
  the prefixes
  @param field
  the field
  @param searcher
  the searcher
  @param lrc
  the lrc
  @return the map
  @throws IOException
  Signals that an I/O exception has occurred.