internal virtual void  Clear()
 {
     terms.Clear();
     queries.Clear();
     docIDs.Clear();
     numTerms  = 0;
     bytesUsed = 0;
 }
Exemple #2
0
        /// <summary> Construct a FieldInfos object using the directory and the name of the file
        /// IndexInput
        /// </summary>
        /// <param name="d">The directory to open the IndexInput from
        /// </param>
        /// <param name="name">The name of the file to open the IndexInput from in the Directory
        /// </param>
        /// <throws>  IOException </throws>
        public /*internal*/ FieldInfos(Directory d, System.String name)
        {
            IndexInput input = d.OpenInput(name);

            try
            {
                try
                {
                    Read(input, name);
                }
                catch (System.IO.IOException ioe)
                {
                    if (format == FORMAT_PRE)
                    {
                        // LUCENE-1623: FORMAT_PRE (before there was a
                        // format) may be 2.3.2 (pre-utf8) or 2.4.x (utf8)
                        // encoding; retry with input set to pre-utf8
                        input.Seek(0);
                        input.SetModifiedUTF8StringsMode();
                        byNumber.Clear();
                        byName.Clear();
                        try
                        {
                            Read(input, name);
                        }
                        catch (System.Exception t)
                        {
                            // Ignore any new exception & throw original IOE
                            throw ioe;
                        }
                    }
                    else
                    {
                        // The IOException cannot be caused by
                        // LUCENE-1623, so re-throw it
                        throw ioe;
                    }
                }
            }
            finally
            {
                input.Close();
            }
        }