Ejemplo n.º 1
0
 /// <summary>
 /// Standardowy konstruktor
 /// </summary>
 /// <param name="sharedData">Dane współdzielone z indekserem IxStdRIIndexer i pozostałymi wątkami</param>
 /// <param name="indexWriter">Cel zapisu indeksu dla wątku, musi być thread-safe albo dedykowany</param>
 /// <param name="finishedEvent">Zdarzenie zakończenia pracy (niesygnalizowane)</param>
 public IxStdRIIndexerThread(IxStdRIIndexerSharedData sharedData, Index.IIxIndexWriter indexWriter, ManualResetEvent finishedEvent)
 {
     this.sharedData = sharedData;
     this.indexWriter = indexWriter;
     this.finishedEvent = finishedEvent;
     this.textTokensListing = new IxTokenizer(sharedData.dictionary);
     this.titleTokensListing = new IxTokenizer(sharedData.dictionary);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Standardowy konstruktor
        /// </summary>
        /// <param name="indexDirPath">Ścieżka do katalogu, gdzie zostaną zapisane dane indeksu (musi nie istnieć bądź być pusty)</param>
        /// <param name="threadCount">Liczba wątków indeksera</param>
        public IxStdRIIndexer(string indexDirPath, uint threadCount)
        {
            if (!Misc.isDirectoryMissingOrEmpty(indexDirPath))
                throw new IxException("Target index directory exists and is not empty");

            this.indexDirPath = Misc.provideEndBackslash(indexDirPath);
            Misc.provideDirectory(this.indexDirPath);

            index = new Index.IxStdDiskRIIndex(this.indexDirPath + "invIndex", IxIndexMode.CREATE);
            documentsIndex = new DocumentsIndex.IxStdDiskDocumentsIndex(this.indexDirPath + "documents", DocumentsIndexMode.CREATE);

            if (IxSettings.createFwdIndex)
                fwdIndex = new IxStdDiskFwdIndex(this.indexDirPath + "fwdIndex", IxIndexMode.CREATE);

            sharedData = new IxStdRIIndexerSharedData();
            sharedData.docIdAllocator = this;

            if (IxSettings.createBkdDictionary)
                sharedData.dictionary = new IxDoubleDictCreator(this, this);
            else
                sharedData.dictionary = createFwdDict(this);

            this.threadCount = threadCount;
        }