code: func NewTermContextFromTerm(ctx IndexReaderContext, t *Term) (tc *TermContext, err error) {
  	assert(ctx != nil && ctx.Parent() == nil)
  	perReaderTermState := NewTermContext(ctx)
  	// fmt.Printf("prts.build term=%v\n", t)
  	for _, leaf := range ctx.Leaves() {
  		// fmt.Printf("  r=%v\n", leaf.reader)
  		if fields := leaf.reader.Fields(); fields != nil {
  			if terms := fields.Terms(t.Field); terms != nil {
  				termsEnum := terms.Iterator(nil)
  				ok, err := termsEnum.SeekExact(t.Bytes)
  				if err != nil {
  					return nil, err
  				}
  				if ok {
  					termState, err := termsEnum.TermState()
  					if err != nil {
  						return nil, err
  					}
  					// log.Println("    found")
  					df, err := termsEnum.DocFreq()
  					if err != nil {
  						return nil, err
  					}
  					tf, err := termsEnum.TotalTermFreq()
  					if err != nil {
  						return nil, err
  					}
  					perReaderTermState.register(termState, leaf.Ord, df, tf)
  				}
  			}
  		}
  	}
  	return perReaderTermState, nil
  }
docs: /**
   * Creates a {@link TermContext} from a top-level {@link IndexReaderContext} and the
   * given {@link Term}. This method will lookup the given term in all context's leaf readers
   * and register each of the readers containing the term in the returned {@link TermContext}
   * using the leaf reader's ordinal.
   * <p>
   * Note: the given context must be a top-level context.
   */