亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? indexreader.cpp

?? clucene是c++版的全文檢索引擎,完全移植于lucene,采用 stl 編寫.
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
      return directory->fileExists("segments");
  }

  TermDocs* IndexReader::termDocs(Term* term) const {
  //Func - Returns an enumeration of all the documents which contain
  //       term. For each document, the document number, the frequency of
  //       the term in that document is also provided, for use in search scoring.
  //       Thus, this method implements the mapping: 
  //
  //       Term => <docNum, freq>*
  //	   The enumeration is ordered by document number.  Each document number
  //       is greater than all that precede it in the enumeration. 
  //Pre  - term != NULL
  //Post - A reference to TermDocs containing an enumeration of all found documents
  //       has been returned

      CND_PRECONDITION(term != NULL, "term is NULL");

      //Reference an instantiated TermDocs instance
      TermDocs* _termDocs = termDocs();
      //Seek all documents containing term
      _termDocs->seek(term);
      //return the enumaration
      return _termDocs;
  }

  TermPositions* IndexReader::termPositions(Term* term) const{
  //Func - Returns an enumeration of all the documents which contain  term. For each 
  //       document, in addition to the document number and frequency of the term in 
  //       that document, a list of all of the ordinal positions of the term in the document 
  //       is available.  Thus, this method implements the mapping:
  //
  //       Term => <docNum, freq,<pos 1, pos 2, ...pos freq-1>>*
  //
  //       This positional information faciliates phrase and proximity searching.
  //       The enumeration is ordered by document number.  Each document number is greater than 
  //       all that precede it in the enumeration. 
  //Pre  - term != NULL
  //Post - A reference to TermPositions containing an enumeration of all found documents
  //       has been returned

      CND_PRECONDITION(term != NULL, "term is NULL");

      //Reference an instantiated termPositions instance
      TermPositions* _termPositions = termPositions();
	  //Seek all documents containing term
      _termPositions->seek(term);
	  //return the enumeration
      return _termPositions;
  }

  void IndexReader::deleteDocument(const int32_t docNum) {
  //Func - Deletes the document numbered docNum.  Once a document is deleted it will not appear 
  //       in TermDocs or TermPostitions enumerations. Attempts to read its field with the document 
  //       method will result in an error.  The presence of this document may still be reflected in 
  //       the docFreq statistic, though this will be corrected eventually as the index is further modified.  
  //Pre  - docNum >= 0
  //Post - If successful the document identified by docNum has been deleted. If no writelock
  //       could be obtained an exception has been thrown stating that the index was locked or has no write access

	  SCOPED_LOCK_MUTEX(THIS_LOCK)

     CND_PRECONDITION(docNum >= 0, "docNum is negative");

      if (directoryOwner)
		  aquireWriteLock();

	  //Have the document identified by docNum deleted
      doDelete(docNum);
      hasChanges = true;
  }

  /**
   * Commit changes resulting from delete, undeleteAll, or setNorm operations
   * 
   * @throws IOException
   */
   void IndexReader::commit(){
    SCOPED_LOCK_MUTEX(THIS_LOCK)
    if(hasChanges){
      if(directoryOwner){
        {
	        SCOPED_LOCK_MUTEX(directory->THIS_LOCK)      // in- & inter-process sync
	
	        LuceneLock* commitLock = directory->makeLock("commit.lock");
	        IndexReaderCommitLockWith cl(commitLock,this);
	        cl.run();
			_CLDELETE(commitLock);
	
	    }
        if (writeLock != NULL) {
          writeLock->release();  // release write lock
          _CLDELETE(writeLock);
        }
      }else
        doCommit();
    }
    hasChanges = false;
  }


  void IndexReader::undeleteAll(){
     SCOPED_LOCK_MUTEX(THIS_LOCK)
    if(directoryOwner)
      aquireWriteLock();
    doUndeleteAll();
    hasChanges = true;
  }

  int32_t IndexReader::deleteDocuments(Term* term) {
  //Func - Deletes all documents containing term. This is useful if one uses a 
  //       document field to hold a unique ID string for the document.  Then to delete such  
  //       a document, one merely constructs a term with the appropriate field and the unique 
  //       ID string as its text and passes it to this method.  
  //Pre  - term != NULL
  //Post - All documents containing term have been deleted. The number of deleted documents
  //       has been returned

      CND_PRECONDITION(term != NULL, "term is NULL");

	  //Search for the documents contain term
      TermDocs* docs = termDocs(term);

	  //Check if documents have been found
	  if ( docs == NULL ){
          return 0;
	  }
    
	  //initialize
	  int32_t Counter = 0;
      try {
		  //iterate through the found documents
          while (docs->next()) {
			  //Delete the document
              deleteDocument(docs->doc());
              Counter++;
          }
      }_CLFINALLY(
		  //Close the enumeration
          docs->close();
          );

    //Delete the enumeration of found documents
    _CLVDELETE( docs ); //todo: not a clucene object... should be

	//Return the number of deleted documents
    return Counter;
  }

  void IndexReader::close() {
  //Func - Closes files associated with this index and also saves any new deletions to disk.
  //       No other methods should be called after this has been called.
  //Pre  - true
  //Post - All files associated with this index have been deleted and new deletions have been 
  //       saved to disk
    SCOPED_LOCK_MUTEX(THIS_LOCK)

	CloseCallbackMap::iterator iter = closeCallbacks.begin();
	for ( ;iter!=closeCallbacks.end();iter++){
		CloseCallback callback = *iter->first;
		callback(this,iter->second);
	}
	
    commit();
    doClose();

	if(closeDirectory){
      directory->close();
	  _CLDECDELETE(directory);
	}
  }
   
  bool IndexReader::isLocked(Directory* directory) {
  //Func - Static method 
  //       Checks if the index in the directory is currently locked.
  //Pre  - directory is a valid reference to a directory to check for a lock
  //Post - Returns true if the index in the named directory is locked otherwise false

	  //Check the existence of the file write.lock and return true when it does and false
	  //when it doesn't
     LuceneLock* l1 = directory->makeLock("write.lock");
     LuceneLock* l2 = directory->makeLock("commit.lock");

	 bool ret = l1->isLocked() || l2->isLocked();

     _CLDELETE(l1);
     _CLDELETE(l2);
     return ret;
  }

  bool IndexReader::isLocked(const char* directory) {
  //Func - Static method 
  //       Checks if the index in the named directory is currently locked.
  //Pre  - directory != NULL and contains the directory to check for a lock
  //Post - Returns true if the index in the named directory is locked otherwise false

      CND_PRECONDITION(directory != NULL, "directory is NULL");

	  //Create a buffer of length CL_MAXDIR
      char f[CL_MAX_PATH+12]; //add 12 in case that directory is already 260 long
	  //Copy the directory string to the buffer
      strcpy(f,directory);
	  //Cat the name of the write.lock file to buffer
      strcat ( f,"/write.lock" );

      Directory* dir = FSDirectory::getDirectory(directory,false);
      bool ret = isLocked(dir);
	  dir->close();
      _CLDECDELETE(dir);

	  return ret;
  }

  void IndexReader::unlock(const char* path){
	  FSDirectory* dir = FSDirectory::getDirectory(path,false);
	  unlock(dir);
	  dir->close();
	  _CLDECDELETE(dir);
  }
  void IndexReader::unlock(Directory* directory){
  //Func - Static method
  //       Forcibly unlocks the index in the named directory->
  //       Caution: this should only be used by failure recovery code,
  //       when it is known that no other process nor thread is in fact
  //       currently accessing this index.
  //Pre  - directory is a valid reference to a directory 
  //Post - The directory has been forcibly unlocked
      LuceneLock* lock;

	  lock = directory->makeLock("write.lock");
      lock->release();
      _CLDELETE(lock);

      lock = directory->makeLock("commit.lock");
      lock->release();
      _CLDELETE(lock);
  }

	void IndexReader::addCloseCallback(CloseCallback callback, void* parameter){
		closeCallbacks.put(callback, parameter);	
	}


	//Constructor	
    IndexReader::IndexReaderLockWith::IndexReaderLockWith(CL_NS(store)::LuceneLock* lock, CL_NS(store)::Directory* dir):
		CL_NS(store)::LuceneLockWith(lock,LUCENE_COMMIT_LOCK_TIMEOUT)
	{
		this->directory = dir;
	}	
	//Constructor	
	IndexReader::IndexReaderCommitLockWith::IndexReaderCommitLockWith( CL_NS(store)::LuceneLock* lock, IndexReader* r ):
		CL_NS(store)::LuceneLockWith(lock,LUCENE_COMMIT_LOCK_TIMEOUT),
		reader(r)
	{
	}
	void* IndexReader::IndexReaderCommitLockWith::doBody(){
		reader->doCommit();
		reader->segmentInfos->write(reader->getDirectory());
		return NULL;
	}

CL_NS_END

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一二三区| eeuss鲁一区二区三区| 亚洲永久精品国产| 国产喂奶挤奶一区二区三区| 欧美视频一区在线| 欧美日韩美少妇| 日韩欧美亚洲国产另类| 精品va天堂亚洲国产| 久久日韩精品一区二区五区| 久久精品视频在线看| 国产精品久久久久久亚洲伦 | 91视频观看视频| 欧美日韩亚洲另类| 国产亲近乱来精品视频 | 精品国产欧美一区二区| 欧美韩日一区二区三区| 一区二区三区免费| 亚洲一区二区三区四区中文字幕 | 亚洲精品国产无天堂网2021 | 另类人妖一区二区av| 色婷婷久久综合| 国产网站一区二区三区| 亚洲免费观看高清完整版在线观看熊| 亚洲成a人在线观看| 国产剧情在线观看一区二区| 91福利在线导航| 久久精品视频免费| 婷婷开心激情综合| 日韩一级免费一区| 亚洲伊人色欲综合网| 美洲天堂一区二卡三卡四卡视频 | 亚洲美女少妇撒尿| 麻豆国产一区二区| 538在线一区二区精品国产| 亚洲精选一二三| 东方aⅴ免费观看久久av| 日韩欧美一二三四区| 亚洲一区二区五区| 欧美伊人久久大香线蕉综合69 | 大尺度一区二区| 精品1区2区在线观看| 蜜臀a∨国产成人精品| 不卡视频一二三| 国产精品乱码一区二三区小蝌蚪| 看电影不卡的网站| 精品电影一区二区三区 | 国内精品不卡在线| 日本一区二区三区在线观看| 精品夜夜嗨av一区二区三区| 欧美三级中文字| 久久99精品视频| 国产午夜精品理论片a级大结局| 激情av综合网| 欧美激情在线观看视频免费| 色综合天天做天天爱| 另类调教123区| 亚洲美女在线一区| 国产亚洲精品bt天堂精选| 在线观看视频一区| 国产传媒欧美日韩成人| 天天色综合天天| 亚洲少妇30p| 国产人成一区二区三区影院| 日韩一区国产二区欧美三区| 91国产福利在线| 成人影视亚洲图片在线| 91蝌蚪国产九色| 国产精品一区不卡| 国产在线视频精品一区| 麻豆成人在线观看| 视频一区视频二区中文| 夜夜嗨av一区二区三区中文字幕| 中文字幕精品—区二区四季| 久久日韩精品一区二区五区| 91精品国产综合久久久久久久久久 | 日韩中文字幕一区二区三区| 亚洲欧美欧美一区二区三区| 中文字幕精品一区二区精品绿巨人 | 蜜臀精品一区二区三区在线观看 | 99精品久久99久久久久| 国产91精品在线观看| 国内精品视频666| 国产成人精品综合在线观看| 国产伦精一区二区三区| 国产一区二区不卡| 国产成人99久久亚洲综合精品| 国产老肥熟一区二区三区| 成人黄色免费短视频| 白白色 亚洲乱淫| 欧美视频中文一区二区三区在线观看| 91丨porny丨在线| 欧美色图12p| 日韩一区二区在线观看视频 | 久久超级碰视频| 国产精品中文字幕日韩精品| 国产成人午夜视频| 一本大道av伊人久久综合| 欧美亚男人的天堂| 日韩久久久久久| 亚洲欧美另类久久久精品| 亚洲午夜三级在线| 国产精品自在在线| 欧美日韩高清一区二区不卡| 久久精品男人的天堂| 日韩经典中文字幕一区| 欧美日韩一级二级| 国产精品入口麻豆原神| 久久99精品视频| 欧美一区2区视频在线观看| 亚洲欧洲三级电影| 国模无码大尺度一区二区三区| 91国在线观看| 亚洲欧洲日产国码二区| 处破女av一区二区| 久久久欧美精品sm网站| 韩国av一区二区三区四区 | 一区二区三区在线看| 韩国女主播成人在线| 日韩精品一区二区三区中文不卡| 一区二区中文字幕在线| 91视频精品在这里| 国产一区二区视频在线| 精品系列免费在线观看| 亚洲成年人影院| 一区二区不卡在线视频 午夜欧美不卡在| 日韩精品一级二级 | 日韩欧美亚洲一区二区| 福利视频网站一区二区三区| 午夜伊人狠狠久久| 国产精品久久久一本精品| 欧美精品在线视频| 99精品国产91久久久久久| 日韩精彩视频在线观看| 欧美久久高跟鞋激| 国产在线乱码一区二区三区| 国产欧美一区二区精品仙草咪| 懂色av一区二区在线播放| 日韩一区在线播放| 欧美裸体一区二区三区| 捆绑变态av一区二区三区| 久久九九影视网| 欧美在线观看你懂的| 日韩av电影免费观看高清完整版在线观看| 欧美日韩精品电影| 国产精品一二三四| 亚洲精品视频在线| 2019国产精品| 欧美色中文字幕| 成人一区二区视频| 日韩综合小视频| 国产精品欧美一区喷水| 欧美日韩国产在线播放网站| 国产一区二区三区免费在线观看| 中文字幕一区日韩精品欧美| 5858s免费视频成人| 色婷婷综合久久| 成人午夜视频免费看| 秋霞午夜鲁丝一区二区老狼| 亚洲色图在线播放| 国产日韩av一区| 久久日韩精品一区二区五区| 日韩你懂的电影在线观看| 粉嫩av一区二区三区| 美女任你摸久久| 久久精品国产亚洲高清剧情介绍| 亚洲精品国产第一综合99久久| 国产精品久久久久久户外露出| 久久综合久久综合亚洲| 精品乱码亚洲一区二区不卡| 日韩视频一区二区在线观看| 精品日韩一区二区| 日韩精品中午字幕| 欧美激情一区二区三区在线| 亚洲精品写真福利| 久久精品国产免费| 日本丰满少妇一区二区三区| 欧美三级在线看| 久久青草欧美一区二区三区| 中文字幕一区二区三区在线播放 | 最新欧美精品一区二区三区| 亚洲最大成人网4388xx| 精品一区二区三区的国产在线播放| 国产经典欧美精品| 在线视频亚洲一区| 精品国产网站在线观看| 综合激情成人伊人| 国产一区二区电影| 欧美日韩一区二区在线视频| 日韩一区二区三区三四区视频在线观看| www日韩大片| 亚洲国产视频一区| 国产伦精一区二区三区| 色老汉av一区二区三区| 欧美一区二区精品| 中文字幕av在线一区二区三区| 亚洲精品v日韩精品| 精品一区二区三区视频| 91国产福利在线| 国产日产欧美精品一区二区三区| 樱花草国产18久久久久|