Exemplo n.º 1
0
        public bool TryGetValue(int docId, out Query.DocumentResult value)
        {
            DocumentResultPoint drp;

            if (TryGetValue(docId, out drp))
            {
                value = *drp.pDocumentResult;
                return(true);
            }
            else
            {
                value = new Hubble.Core.Query.DocumentResult();
                return(false);
            }
        }
Exemplo n.º 2
0
        unsafe public void Add(int docId, Query.DocumentResult value)
        {
            if (_MemList == null)
            {
                _MemList = new List <IntPtr>();

                _MemList.Add(Alloc(_UnitSize));

                _Cur = (Query.DocumentResult *)_MemList[_MemList.Count - 1];
            }

            try
            {
                base.Add(docId, new DocumentResultPoint(_Cur));
            }
            catch (Exception e)
            {
                throw new ParseException(string.Format("Docid={0} err:{1}",
                                                       docId, e.Message));
            }

            *_Cur = value;

            _UnitIndex++;

            if (_UnitIndex >= _UnitSize)
            {
                _MemList.Add(Alloc(_UnitSize));
                _UnitIndex = 0;
                _Cur       = (Query.DocumentResult *)_MemList[_MemList.Count - 1];
            }
            else
            {
                _Cur++;
            }
        }