<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [Xunsearch PHP-SDK](http://www.xunsearch.com) v1.4.8 API 參考文檔 # XSFieldScheme [All Packages](#)| [方法(函數)](#) | 包 | [XS](#) | |-----|-----| | 繼承關系 | class XSFieldScheme | | 實現接口 | IteratorAggregate, Traversable | | 版本 | 1.0.0 | | 源代碼 | [sdk/php/lib/XSFieldScheme.class.php](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php) | XS 數據字段方案每個方案包含若干個字段結構對象 [XSFieldMeta](#)每個方案必須并且只能包含一個類型為 ID 的字段, 支持 foreach 遍歷所有字段 ### Public 方法 [隱去繼承來的方法](#) | 名稱 | 描述 | 定義于 | |-----|-----|-----| | [__toString()](#) | 將對象轉換為配置文件字符串 | XSFieldScheme | | [addField()](#) | 添加字段到方案中 | XSFieldScheme | | [checkValid()](#) | 判斷該字段方案是否有效、可用 | XSFieldScheme | | [getAllFields()](#) | 獲取項目所有字段結構設置 | XSFieldScheme | | [getField()](#) | 獲取項目字段元數據 | XSFieldScheme | | [getFieldBody()](#) | 獲取內容字段元數據 | XSFieldScheme | | [getFieldId()](#) | 獲取主鍵字段元數據 | XSFieldScheme | | [getFieldTitle()](#) | 獲取標題字段元數據 | XSFieldScheme | | [getIterator()](#) | IteratorAggregate 接口, 以支持 foreach 遍歷訪問所有字段 | XSFieldScheme | | [getVnoMap()](#) | 獲取所有字段的vno與名稱映映射關系 | XSFieldScheme | | [logger()](#) | 獲取搜索日志的字段方案 | XSFieldScheme | ### 方法明細 __toString()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public void <b>__toString</b>()</div></td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L33](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L33) (**[顯示](#)**) `public?function?__toString() { ????$str?=?''; ????foreach?($this->_fields?as?$field)?{ ????????$str?.=?$field->toConfig()?.?"\n"; ????} ????return?$str; }` 將對象轉換為配置文件字符串 addField()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public void <b>addField</b>(mixed $field, array $config=NULL)</div></td></tr><tr><td class="paramNameCol">$field</td> <td class="paramTypeCol">mixed</td> <td class="paramDescCol">若類型為 XSFieldMeta 表示要添加的字段對象, 若類型為 string 表示字段名稱, 連同 $config 參數一起創建字段對象</td></tr><tr><td class="paramNameCol">$config</td> <td class="paramTypeCol">array</td> <td class="paramDescCol">當 $field 參數為 string 時作為新建字段的配置內容</td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L139](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L139) (**[顯示](#)**) `public?function?addField($field,?$config?=?null) { ????if?(!$field?instanceof?XSFieldMeta)?{ ????????$field?=?new?XSFieldMeta($field,?$config); ????} ????if?(isset($this->_fields[$field->name]))?{ ????????throw?new?XSException('Duplicated?field?name:?`'?.?$field->name?.?'\''); ????} ????if?($field->isSpeical())?{ ????????if?(isset($this->_typeMap[$field->type]))?{ ????????????$prev?=?$this->_typeMap[$field->type]; ????????????throw?new?XSException('Duplicated?'?.?strtoupper($config['type'])?.?'?field:?`'?.?$field->name?.?'\'?and?`'?.?$prev?.?'\''); ????????} ????????$this->_typeMap[$field->type]?=?$field->name; ????} ????$field->vno?=?($field->type?==?XSFieldMeta::TYPE_BODY)???self::MIXED_VNO?:?count($this->_vnoMap); ????$this->_vnoMap[$field->vno]?=?$field->name; ????//?save?field,?ensure?ID?is?the?first?field ????if?($field->type?==?XSFieldMeta::TYPE_ID)?{ ????????$this->_fields?=?array_merge(array($field->name?=>?$field),?$this->_fields); ????}?else?{ ????????$this->_fields[$field->name]?=?$field; ????} }` 添加字段到方案中每個方案中的特殊類型字段都不能重復出現 checkValid()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public bool <b>checkValid</b>(bool $throw=false)</div></td></tr><tr><td class="paramNameCol">$throw</td> <td class="paramTypeCol">bool</td> <td class="paramDescCol">當沒有通過檢測時是否拋出異常, 默認為 false</td></tr><tr><td class="paramNameCol">{return}</td> <td class="paramTypeCol">bool</td> <td class="paramDescCol">有效返回 true, 無效則返回 false</td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L175](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L175) (**[顯示](#)**) `public?function?checkValid($throw?=?false) { ????if?(!isset($this->_typeMap[XSFieldMeta::TYPE_ID]))?{ ????????if?($throw)?{ ????????????throw?new?XSException('Missing?field?of?type?ID'); ????????} ????????return?false; ????} ????return?true; }` 判斷該字段方案是否有效、可用每個方案必須并且只能包含一個類型為 ID 的字段 getAllFields()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public XSFieldMeta[] <b>getAllFields</b>()</div></td></tr><tr><td class="paramNameCol">{return}</td> <td class="paramTypeCol">XSFieldMeta[]</td> <td class="paramDescCol"></td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L117](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L117) (**[顯示](#)**) `public?function?getAllFields() { ????return?$this->_fields; }` 獲取項目所有字段結構設置 getField()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public <a href="XSFieldMeta.html">XSFieldMeta</a> <b>getField</b>(mixed $name, bool $throw=true)</div></td></tr><tr><td class="paramNameCol">$name</td> <td class="paramTypeCol">mixed</td> <td class="paramDescCol">字段名稱(string) 或字段序號(vno, int)</td></tr><tr><td class="paramNameCol">$throw</td> <td class="paramTypeCol">bool</td> <td class="paramDescCol">當字段不存在時是否拋出異常, 默認為 true</td></tr><tr><td class="paramNameCol">{return}</td> <td class="paramTypeCol"><a href="XSFieldMeta.html">XSFieldMeta</a></td> <td class="paramDescCol">字段元數據對象, 若不存在則返回 false</td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L93](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L93) (**[顯示](#)**) `public?function?getField($name,?$throw?=?true) { ????if?(is_int($name))?{ ????????if?(!isset($this->_vnoMap[$name]))?{ ????????????if?($throw?===?true)?{ ????????????????throw?new?XSException('Not?exists?field?with?vno:?`'?.?$name?.?'\''); ????????????} ????????????return?false; ????????} ????????$name?=?$this->_vnoMap[$name]; ????} ????if?(!isset($this->_fields[$name]))?{ ????????if?($throw?===?true)?{ ????????????throw?new?XSException('Not?exists?field?with?name:?`'?.?$name?.?'\''); ????????} ????????return?false; ????} ????return?$this->_fields[$name]; }` 獲取項目字段元數據 getFieldBody()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public <a href="XSFieldMeta.html">XSFieldMeta</a> <b>getFieldBody</b>()</div></td></tr><tr><td class="paramNameCol">{return}</td> <td class="paramTypeCol"><a href="XSFieldMeta.html">XSFieldMeta</a></td> <td class="paramDescCol">類型為 BODY 的字段</td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L77](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L77) (**[顯示](#)**) `public?function?getFieldBody() { ????if?(isset($this->_typeMap[XSFieldMeta::TYPE_BODY]))?{ ????????$name?=?$this->_typeMap[XSFieldMeta::TYPE_BODY]; ????????return?$this->_fields[$name]; ????} ????return?false; }` 獲取內容字段元數據 getFieldId()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public <a href="XSFieldMeta.html">XSFieldMeta</a> <b>getFieldId</b>()</div></td></tr><tr><td class="paramNameCol">{return}</td> <td class="paramTypeCol"><a href="XSFieldMeta.html">XSFieldMeta</a></td> <td class="paramDescCol">類型為 ID 的字段</td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L46](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L46) (**[顯示](#)**) `public?function?getFieldId() { ????if?(isset($this->_typeMap[XSFieldMeta::TYPE_ID]))?{ ????????$name?=?$this->_typeMap[XSFieldMeta::TYPE_ID]; ????????return?$this->_fields[$name]; ????} ????return?false; }` 獲取主鍵字段元數據 getFieldTitle()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public <a href="XSFieldMeta.html">XSFieldMeta</a> <b>getFieldTitle</b>()</div></td></tr><tr><td class="paramNameCol">{return}</td> <td class="paramTypeCol"><a href="XSFieldMeta.html">XSFieldMeta</a></td> <td class="paramDescCol">類型為 TITLE 的字段</td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L59](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L59) (**[顯示](#)**) `public?function?getFieldTitle() { ????if?(isset($this->_typeMap[XSFieldMeta::TYPE_TITLE]))?{ ????????$name?=?$this->_typeMap[XSFieldMeta::TYPE_TITLE]; ????????return?$this->_fields[$name]; ????} ????foreach?($this->_fields?as?$name?=>?$field)?{ ????????if?($field->type?===?XSFieldMeta::TYPE_STRING?&&?!$field->isBoolIndex())?{ ????????????return?$field; ????????} ????} ????return?false; }` 獲取標題字段元數據 getIterator()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public void <b>getIterator</b>()</div></td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L189](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L189) (**[顯示](#)**) `public?function?getIterator() { ????return?new?ArrayIterator($this->_fields); }` IteratorAggregate 接口, 以支持 foreach 遍歷訪問所有字段 getVnoMap()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public array <b>getVnoMap</b>()</div></td></tr><tr><td class="paramNameCol">{return}</td> <td class="paramTypeCol">array</td> <td class="paramDescCol">vno為鍵, 字段名為值的數組</td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L126](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L126) (**[顯示](#)**) `public?function?getVnoMap() { ????return?$this->_vnoMap; }` 獲取所有字段的vno與名稱映映射關系 logger()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public static XSFieldScheme <b>logger</b>()</div></td></tr><tr><td class="paramNameCol">{return}</td> <td class="paramTypeCol">XSFieldScheme</td> <td class="paramDescCol">搜索日志字段方案</td></tr></table> **源碼:**[sdk/php/lib/XSFieldScheme.class.php#L198](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSFieldScheme.class.php#L198) (**[顯示](#)**) `public?static?function?logger() { ????if?(self::$_logger?===?null)?{ ????????$scheme?=?new?self; ????????$scheme->addField('id',?array('type'?=>?'id')); ????????$scheme->addField('pinyin'); ????????$scheme->addField('partial'); ????????$scheme->addField('total',?array('type'?=>?'numeric',?'index'?=>?'self')); ????????$scheme->addField('lastnum',?array('type'?=>?'numeric',?'index'?=>?'self')); ????????$scheme->addField('currnum',?array('type'?=>?'numeric',?'index'?=>?'self')); ????????$scheme->addField('currtag',?array('type'?=>?'string')); ????????$scheme->addField('body',?array('type'?=>?'body')); ????????self::$_logger?=?$scheme; ????} ????return?self::$_logger; }` 獲取搜索日志的字段方案 Copyright ? 2008-2011 by [杭州云圣網絡科技有限公司](http://www.xunsearch.com) All Rights Reserved.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看