查詢

SolrQuery::removeFacetDateOther()函式—用法及示例

「 從SolrQuery物件中移除facet.date.other引數,該引數用於控制是否在日期facet結果中包含其他值(即不在指定日期範圍內的值) 」


函式名稱:SolrQuery::removeFacetDateOther()

適用版本:Solr PECL擴充套件版本 2.0.0以上

函式描述:該函式用於從SolrQuery物件中移除facet.date.other引數,該引數用於控制是否在日期facet結果中包含其他值(即不在指定日期範圍內的值)。

用法示例:

// 建立SolrQuery物件
$query = new SolrQuery();

// 設定facet.date.other引數為true
$query->setFacetDateOther(true);

// 列印設定前的facet.date.other引數值
echo "設定前的facet.date.other引數值:";
var_dump($query->getFacetDateOther());

// 移除facet.date.other引數
$query->removeFacetDateOther();

// 列印移除後的facet.date.other引數值
echo "移除後的facet.date.other引數值:";
var_dump($query->getFacetDateOther());

輸出:

設定前的facet.date.other引數值:bool(true)
移除後的facet.date.other引數值:NULL

注意事項:

  • 在呼叫removeFacetDateOther()函式之前,必須先使用setFacetDateOther()函式設定facet.date.other引數為true或false。
  • 呼叫removeFacetDateOther()函式後,getFacetDateOther()函式將返回NULL,表示facet.date.other引數已被移除。
  • 該函式僅適用於使用Solr PECL擴充套件的PHP版本,並且Solr PECL擴充套件版本必須為2.0.0以上。
補充糾錯
熱門PHP函式
分享連結