예제 #1
0
            public override void  SetNextReader(IndexReader reader, int docBase)
            {
                StringIndex currentReaderValues = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);

                currentReaderGen++;
                order  = currentReaderValues.order;
                lookup = currentReaderValues.lookup;
                System.Diagnostics.Debug.Assert(lookup.Length > 0);
                if (bottomSlot != -1)
                {
                    Convert(bottomSlot);
                    bottomOrd = ords[bottomSlot];
                }
            }
예제 #2
0
 protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
 {
     System.String field = StringHelper.Intern(entryKey.field);
     int[] retArray = new int[reader.MaxDoc];
     System.String[] mterms = new System.String[reader.MaxDoc + 1];
     TermDocs termDocs = reader.TermDocs();
     TermEnum termEnum = reader.Terms(new Term(field));
     int t = 0; // current term number
     
     // an entry for documents that have no terms in this field
     // should a document with no terms be at top or bottom?
     // this puts them at the top - if it is changed, FieldDocSortedHitQueue
     // needs to change as well.
     mterms[t++] = null;
     
     try
     {
         do 
         {
             Term term = termEnum.Term;
             if (term == null || term.Field != field || t >= mterms.Length) break;
             
             // store term text
             mterms[t] = term.Text;
             
             termDocs.Seek(termEnum);
             while (termDocs.Next())
             {
                 retArray[termDocs.Doc] = t;
             }
             
             t++;
         }
         while (termEnum.Next());
     }
     finally
     {
         termDocs.Close();
         termEnum.Close();
     }
     
     if (t == 0)
     {
         // if there are no terms, make the term array
         // have a single null entry
         mterms = new System.String[1];
     }
     else if (t < mterms.Length)
     {
         // if there are less terms than documents,
         // trim off the dead array space
         System.String[] terms = new System.String[t];
         Array.Copy(mterms, 0, terms, 0, t);
         mterms = terms;
     }
     
     StringIndex value_Renamed = new StringIndex(retArray, mterms);
     return value_Renamed;
 }
예제 #3
0
            protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
            {
                System.String   field    = StringHelper.Intern((System.String)entryKey.field);
                int[]           retArray = new int[reader.MaxDoc()];
                System.String[] mterms   = new System.String[reader.MaxDoc() + 1];
                TermDocs        termDocs = reader.TermDocs();
                TermEnum        termEnum = reader.Terms(new Term(field));
                int             t        = 0; // current term number

                // an entry for documents that have no terms in this field
                // should a document with no terms be at top or bottom?
                // this puts them at the top - if it is changed, FieldDocSortedHitQueue
                // needs to change as well.
                mterms[t++] = null;

                try
                {
                    do
                    {
                        Term term = termEnum.Term();
                        if (term == null || (System.Object)term.Field() != (System.Object)field)
                        {
                            break;
                        }

                        // store term text
                        // we expect that there is at most one term per document
                        if (t >= mterms.Length)
                        {
                            throw new System.SystemException("there are more terms than " + "documents in field \"" + field + "\", but it's impossible to sort on " + "tokenized fields");
                        }
                        mterms[t] = term.Text();

                        termDocs.Seek(termEnum);
                        while (termDocs.Next())
                        {
                            retArray[termDocs.Doc()] = t;
                        }

                        t++;
                    }while (termEnum.Next());
                }
                finally
                {
                    termDocs.Close();
                    termEnum.Close();
                }

                if (t == 0)
                {
                    // if there are no terms, make the term array
                    // have a single null entry
                    mterms = new System.String[1];
                }
                else if (t < mterms.Length)
                {
                    // if there are less terms than documents,
                    // trim off the dead array space
                    System.String[] terms = new System.String[t];
                    Array.Copy(mterms, 0, terms, 0, t);
                    mterms = terms;
                }

                StringIndex value_Renamed = new StringIndex(retArray, mterms);

                return(value_Renamed);
            }
 public FieldCacheTermsFilterDocIdSet(FieldCacheTermsFilter enclosingInstance, StringIndex fcsi)
 {
     InitBlock(enclosingInstance);
     this.fcsi  = fcsi;
     openBitSet = new OpenBitSet(this.fcsi.lookup.Length);
     foreach (string t in Enclosing_Instance.terms)
     {
         int termNumber = this.fcsi.BinarySearchLookup(t);
         if (termNumber > 0)
         {
             openBitSet.FastSet(termNumber);
         }
     }
 }
예제 #5
0
            protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
            {
                System.String field = StringHelper.Intern((System.String) entryKey.field);
                int[] retArray = new int[reader.MaxDoc()];
                System.String[] mterms = new System.String[reader.MaxDoc() + 1];
                TermDocs termDocs = reader.TermDocs();
                TermEnum termEnum = reader.Terms(new Term(field));
                int t = 0; // current term number

                // an entry for documents that have no terms in this field
                // should a document with no terms be at top or bottom?
                // this puts them at the top - if it is changed, FieldDocSortedHitQueue
                // needs to change as well.
                mterms[t++] = null;

                try
                {
                    do
                    {
                        Term term = termEnum.Term();
                        if (term == null || (System.Object) term.Field() != (System.Object) field)
                            break;

                        // store term text
                        // we expect that there is at most one term per document
                        if (t >= mterms.Length)
                            throw new System.SystemException("there are more terms than " + "documents in field \"" + field + "\", but it's impossible to sort on " + "tokenized fields");
                        mterms[t] = term.Text();

                        termDocs.Seek(termEnum);
                        while (termDocs.Next())
                        {
                            retArray[termDocs.Doc()] = t;
                        }

                        t++;
                    }
                    while (termEnum.Next());
                }
                finally
                {
                    termDocs.Close();
                    termEnum.Close();
                }

                if (t == 0)
                {
                    // if there are no terms, make the term array
                    // have a single null entry
                    mterms = new System.String[1];
                }
                else if (t < mterms.Length)
                {
                    // if there are less terms than documents,
                    // trim off the dead array space
                    System.String[] terms = new System.String[t];
                    Array.Copy(mterms, 0, terms, 0, t);
                    mterms = terms;
                }

                StringIndex value_Renamed = new StringIndex(retArray, mterms);
                return value_Renamed;
            }
			public FieldCacheTermsFilterDocIdSet(FieldCacheTermsFilter enclosingInstance, StringIndex fcsi)
			{
				InitBlock(enclosingInstance);
				this.fcsi = fcsi;
				openBitSet = new OpenBitSet(this.fcsi.lookup.Length);
				foreach (string t in Enclosing_Instance.terms)
				{
					int termNumber = this.fcsi.BinarySearchLookup(t);
					if (termNumber > 0)
					{
						openBitSet.FastSet(termNumber);
					}
				}
			}
예제 #7
0
            protected internal override object CreateValue(IndexReader reader, Entry entryKey)
            {
                string field = StringHelper.Intern(entryKey.field);

                int[]    retArray = new int[reader.MaxDoc];
                string[] mterms   = new string[reader.MaxDoc + 1];
                TermDocs termDocs = reader.TermDocs();
                TermEnum termEnum = reader.Terms(new Term(field));
                int      t        = 0; // current term number

                // an entry for documents that have no terms in this field
                // should a document with no terms be at top or bottom?
                // this puts them at the top - if it is changed, FieldDocSortedHitQueue
                // needs to change as well.
                mterms[t++] = null;

                try
                {
                    do
                    {
                        Term term = termEnum.Term;
                        if (term == null || term.Field != field || t >= mterms.Length)
                        {
                            break;
                        }

                        // store term text
                        mterms[t] = term.Text;

                        termDocs.Seek(termEnum);
                        while (termDocs.Next())
                        {
                            retArray[termDocs.Doc] = t;
                        }

                        t++;
                    }while (termEnum.Next());
                }
                finally
                {
                    termDocs.Close();
                    termEnum.Close();
                }

                if (t == 0)
                {
                    // if there are no terms, make the term array
                    // have a single null entry
                    mterms = new string[1];
                }
                else if (t < mterms.Length)
                {
                    // if there are less terms than documents,
                    // trim off the dead array space
                    string[] terms = new string[t];
                    Array.Copy(mterms, 0, terms, 0, t);
                    mterms = terms;
                }

                StringIndex value_Renamed = new StringIndex(retArray, mterms);

                return(value_Renamed);
            }
예제 #8
0
 public StringOrdDocComparator(StringIndex values)
 {
     this.values = values;
 }