代码改变世界

lucene fenlei

2011-10-14 18:24  yuejianjun  阅读(168)  评论(0编辑  收藏  举报
        private StringIndex[] stringIndex_Group;
        private bool isGroup = false;
        public string[] strType ;
        public   int[][] GroupInt;
        public string[][] GroupString;

 

 public override void  Collect(int doc) :     

 if (isGroup)
                {
                    for (int i = 0; i < strType.Length; i++)
                    {
                        GroupInt[i][stringIndex_Group[i].order[doc]]++; //GroupInt[stringIndex_Group.order[doc]]++; 
                    }

                } 

         public override void  SetNextReader(IndexReader reader, int base_Renamed)

        {
            docBase = base_Renamed;
            if (isGroup)
            { 
                int len;
                GroupInt = new int[strType.Length][];
                GroupString = new string[strType.Length][];
                stringIndex_Group = new StringIndex[strType.Length];
                for (int i = 0; i < strType.Length; i++)
                {
                    stringIndex_Group[i] = SingletonFieldCache_StringIndex_Group.GetInstance(reader, strType[i]);
                    len=stringIndex_Group[i].lookup.Length;
                    GroupInt[i] = new int[len];
                    GroupString[i]= stringIndex_Group[i].lookup;
                }
            }
        }

 

        public static TopScoreDocCollector create(int numHits, bool docsScoredInOrder, bool isGroup, string[] strType)

        {
           
            if (docsScoredInOrder)
            {
                return new InOrderTopScoreDocCollector(numHits);
            }
            else
            {
                return new OutOfOrderTopScoreDocCollector(numHits, isGroup,strType );
            }
        }