⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 balancer.php

📁 java的php集成工具
💻 PHP
📖 第 1 页 / 共 2 页
字号:
			}			throw new Exception('No write services were available');		}		return $this->_writeableServices[$this->_currentWriteService];	}	public function setCreateDocuments($createDocuments)	{		$this->_createDocuments = (bool) $createDocuments;		if ($this->_currentReadService)		{			$service = $this->_selectReadService();			$service->setCreateDocuments($createDocuments);		}	}	public function getCreateDocuments()	{		return $this->_createDocuments;	}	/**	 * Raw Add Method. Takes a raw post body and sends it to the update service.  Post body	 * should be a complete and well formed "add" xml document.	 *	 * @param string $rawPost	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function add($rawPost)	{		$service = $this->_selectWriteService();		do		{			try			{				return $service->add($rawPost);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectWriteService(true);		} while ($service);	}	/**	 * Add a Solr Document to the index	 *	 * @param Apache_Solr_Document $document	 * @param boolean $allowDups	 * @param boolean $overwritePending	 * @param boolean $overwriteCommitted	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function addDocument(Apache_Solr_Document $document, $allowDups = false, $overwritePending = true, $overwriteCommitted = true)	{		$service = $this->_selectWriteService();		do		{			try			{				return $service->addDocument($document, $allowDups, $overwritePending, $overwriteCommitted);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectWriteService(true);		} while ($service);	}	/**	 * Add an array of Solr Documents to the index all at once	 *	 * @param array $documents Should be an array of Apache_Solr_Document instances	 * @param boolean $allowDups	 * @param boolean $overwritePending	 * @param boolean $overwriteCommitted	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function addDocuments($documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true)	{		$service = $this->_selectWriteService();		do		{			try			{				return $service->addDocuments($documents, $allowDups, $overwritePending, $overwriteCommitted);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectWriteService(true);		} while ($service);	}	/**	 * Send a commit command.  Will be synchronous unless both wait parameters are set	 * to false.	 *	 * @param boolean $waitFlush	 * @param boolean $waitSearcher	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function commit($optimize = true, $waitFlush = true, $waitSearcher = true, $timeout = 3600)	{		$service = $this->_selectWriteService();		do		{			try			{				return $service->commit($optimize, $waitFlush, $waitSearcher, $timeout);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectWriteService(true);		} while ($service);	}	/**	 * Raw Delete Method. Takes a raw post body and sends it to the update service. Body should be	 * a complete and well formed "delete" xml document	 *	 * @param string $rawPost	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function delete($rawPost)	{		$service = $this->_selectWriteService();		do		{			try			{				return $service->delete($rawPost);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectWriteService(true);		} while ($service);	}	/**	 * Create a delete document based on document ID	 *	 * @param string $id	 * @param boolean $fromPending	 * @param boolean $fromCommitted	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function deleteById($id, $fromPending = true, $fromCommitted = true)	{		$service = $this->_selectWriteService();		do		{			try			{				return $service->deleteById($id, $fromPending, $fromCommitted);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectWriteService(true);		} while ($service);	}	/**	 * Create a delete document based on a query and submit it	 *	 * @param string $rawQuery	 * @param boolean $fromPending	 * @param boolean $fromCommitted	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function deleteByQuery($rawQuery, $fromPending = true, $fromCommitted = true)	{		$service = $this->_selectWriteService();		do		{			try			{				return $service->deleteByQuery($rawQuery, $fromPending, $fromCommitted);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectWriteService(true);		} while ($service);	}	/**	 * Send an optimize command.  Will be synchronous unless both wait parameters are set	 * to false.	 *	 * @param boolean $waitFlush	 * @param boolean $waitSearcher	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function optimize($waitFlush = true, $waitSearcher = true)	{		$service = $this->_selectWriteService();		do		{			try			{				return $service->optimize($waitFlush, $waitSearcher);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectWriteService(true);		} while ($service);	}	/**	 * Simple Search interface	 *	 * @param string $query The raw query string	 * @param int $offset The starting offset for result documents	 * @param int $limit The maximum number of result documents to return	 * @param array $params key / value pairs for query parameters, use arrays for multivalued parameters	 * @return Apache_Solr_Response	 *	 * @throws Exception If an error occurs during the service call	 */	public function search($query, $offset = 0, $limit = 10, $params = array())	{		$service = $this->_selectReadService();		do		{			try			{				return $service->search($query, $offset, $limit, $params);			}			catch (Exception $e)			{				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR				{					throw $e;				}			}			$service = $this->_selectReadService(true);		} while ($service);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -