public TextReader GetText(ulong docId, ulong fieldId)
        {
            var key     = GetKeyForPositions('T', docId, fieldId);
            var matcher = new DfaTermMatcher(new SequenceMatcher <char>(key, false));
            var term    = PosIndex.GetTerms(matcher).Single();

            return(PositionsReader.GetText(term.Value.Offset));
        }
 public void Dispose()
 {
     PositionsReader?.Dispose();
     PosIndex?.Dispose();
     PostingLists?.Dispose();
     Dictionary?.Dispose();
     Fields?.Dispose();
     HeaderReader?.Dispose();
 }
        public IEnumerable <TextPosition> GetPositions(ulong docId, ulong fieldId)
        {
            var key     = GetKeyForPositions('P', docId, fieldId);
            var matcher = new DfaTermMatcher(new SequenceMatcher <char>(key, false));
            var term    = PosIndex.GetTerms(matcher).Single();
            var offset  = -1;

            foreach (var pos in PositionsReader.Get(term.Value.Offset))
            {
                if (offset == -1)
                {
                    offset = (int)pos;
                }
                else
                {
                    yield return(TextPosition.P(offset - 1, (int)pos - offset));

                    offset = -1;
                }
            }
        }
    // private void Update () {

    // }

    // 1. 어떤 유닛을 만들지 선택하는 UI
//     public void SelectUnitUI(int type)
//     {
// //        InstantiateUnit (rangePrefab, position);
//         // 어떤 유닛을 선택했는지 기억해야 한다.
//         unitType = (UnitType)type;

//         // 2. 소환 버튼을 누르면 위치 선정하는 버튼이 나온다.
//         positionButton.SetActive(true);
//         unitSelectButton.SetActive(false);
//     }

    // 2. 어디서 생성할지 선택하는 UI
    public void SelectPositionUI(int index)
    {
        //  - 선택한 위치에서 내가 원하는 유닛을 생성하고 싶다.
        posIndex = (PosIndex)index;
        //  - 유닛 종류에 따라서 게임 설정값을 달리하고 싶다.
    }