Exemplo n.º 1
0
        public float GetScores(int id, int[] freqs, float[] boosts, IFacetTermScoringFunction function)
        {
            function.ClearScores();
            // NOTE: Added Get() extension method call because
            // the default .NET behavior throws an exception if the
            // index is out of bounds, rather than returning null.
            int[] page = m_list.Get(id >> PAGEID_SHIFT);
            int   val  = page[id & SLOTID_MASK];

            if (val >= 0)
            {
                return(function.Score(freqs[val], boosts[val]));
            }
            else
            {
                int num = (val & COUNT_MASK);
                val >>= VALIDX_SHIFT; // signed shift, remember this is a negative number
                int idx;
                for (int i = 0; i < num; i++)
                {
                    idx = page[i - val];
                    function.ScoreAndCollect(freqs[idx], boosts[idx]);
                }
                return(function.GetCurrentScore());
            }
        }
Exemplo n.º 2
0
 protected BoboDocScorer(IFacetTermScoringFunction scoreFunction, float[] boostList)
 {
     m_function  = scoreFunction;
     m_boostList = boostList;
 }
Exemplo n.º 3
0
        public float GetScores(int id, int[] freqs, float[] boosts, IFacetTermScoringFunction function)
        {
            function.ClearScores();
            // NOTE: Added Get() extension method call because 
            // the default .NET behavior throws an exception if the
            // index is out of bounds, rather than returning null.
            int[] page = _list.Get(id >> PAGEID_SHIFT);
            int val = page[id & SLOTID_MASK];

            if (val >= 0)
            {
                return function.Score(freqs[val], boosts[val]);
            }
            else
            {
                int num = (val & COUNT_MASK);
                val >>= VALIDX_SHIFT; // signed shift, remember this is a negative number
                int idx;
                for (int i = 0; i < num; i++)
                {
                    idx = page[i - val];
                    function.ScoreAndCollect(freqs[idx], boosts[idx]);
                }
                return function.GetCurrentScore();
            }
        }
        public float getScores(int id, int[] freqs, float[] boosts, IFacetTermScoringFunction function)
        {
            function.ClearScores();
            int[] page = _list[id >> PAGEID_SHIFT];
            int val = page[id & SLOTID_MASK];

            if (val >= 0)
            {
                return function.Score(freqs[val], boosts[val]);
            }
            else
            {
                int num = (val & COUNT_MASK);
                val >>= VALIDX_SHIFT; // signed shift, remember this is a negative number
                int idx;
                for (int i = 0; i < num; i++)
                {
                    idx = page[i - val];
                    function.ScoreAndCollect(freqs[idx], boosts[idx]);
                }
                return function.GetCurrentScore();
            }
        }
Exemplo n.º 5
0
 protected BoboDocScorer(IFacetTermScoringFunction scoreFunction, float[] boostList)
 {
     _function = scoreFunction;
     _boostList = boostList;
 }