Example #1
0
            public sealed override int Advance(int targetId)
            {
                if (_doc < targetId)
                {
                    _doc = targetId - 1;
                }

                float x  = _targetX;
                float xu = x + _delta;
                float xl = x - _delta;
                float y  = _targetY;
                float yu = y + _delta;
                float yl = y - _delta;
                float z  = _targetZ;
                float zu = z + _delta;
                float zl = z - _delta;

                int docid = _doc;

                while (docid < _maxDoc)
                {
                    docid++;

                    float docX = _xvals.Get(docid);
                    if (docX > xu || docX < xl)
                    {
                        continue;
                    }

                    float docY = _yvals.Get(docid);
                    if (docY > yu || docY < yl)
                    {
                        continue;
                    }

                    float docZ = _zvals.Get(docid);
                    if (docZ > zu || docZ < zl)
                    {
                        continue;
                    }

                    if (GeoFacetFilter.InCircle(docX, docY, docZ, _targetX, _targetY, _targetZ, _radius))
                    {
                        _doc = docid;
                        return(_doc);
                    }
                }
                _doc = DocIdSetIterator.NO_MORE_DOCS;
                return(_doc);
            }
            public sealed override int Advance(int targetId)
            {
                if (m_doc < targetId)
                {
                    m_doc = targetId - 1;
                }

                float x  = m_targetX;
                float xu = x + m_delta;
                float xl = x - m_delta;
                float y  = m_targetY;
                float yu = y + m_delta;
                float yl = y - m_delta;
                float z  = m_targetZ;
                float zu = z + m_delta;
                float zl = z - m_delta;

                int docid = m_doc;

                while (++docid < m_maxDoc)
                {
                    float docX = m_xvals.Get(docid);
                    if (docX > xu || docX < xl)
                    {
                        continue;
                    }

                    float docY = m_yvals.Get(docid);
                    if (docY > yu || docY < yl)
                    {
                        continue;
                    }

                    float docZ = m_zvals.Get(docid);
                    if (docZ > zu || docZ < zl)
                    {
                        continue;
                    }

                    if (GeoFacetFilter.InCircle(docX, docY, docZ, m_targetX, m_targetY, m_targetZ, m_radius))
                    {
                        m_doc = docid;
                        return(m_doc);
                    }
                }
                m_doc = DocIdSetIterator.NO_MORE_DOCS;
                return(m_doc);
            }