AEM查詢產生器API中的查詢結果不一致

在Adobe Experience Manager (AEM)中,如果使用非預期索引,則使用查詢產生器API執行查詢會傳回不一致的結果。 若要修正,請使用index指定所要的索引 查詢產生器API中的標籤。

說明 description

環境

  • 產品: AEM Managed Services, Sites , v6.5
  • 執行個體:生產

問題/症狀

在查詢執行期間使用非預期的索引時,查詢結果不一致。

解決方法 resolution

若要修正此問題,請按照下列步驟操作

  1. 透過使用自訂值指定/oak:index/<index>屬性,將標籤指派給tags中的自訂索引定義。

  2. 在查詢產生器API查詢中使用p.indexTag引數。

  3. p.indexTag=<tagname>新增至查詢,其中<tagname>符合自訂索引標籤。

  4. 確認查詢使用預期的自訂索引。 例如:

    • 範例自訂索引定義(在/oak:index/fullTextSearch下): jcr:mixinTypes="[ rep:AccessControllable] "
      async="[ async,nrt] "
      compatVersion="{Long}2"
      evaluatePathRestrictions="{Boolean}true"
      excludedPaths="[ /var,/etc/replication,/etc/workflow/instances,/jcr:system] "
      includedPaths="[ /content/mysite] "
      queryPaths="[ /content/mysite] "
      reindex="{Boolean}false"
      reindexCount="{Long}1"
      seed="{Long}-4788584413483415353"
      type="lucene"
      tags="[ customSearch] "
    • 使用特定索引的XPath查詢: /jcr:root/content/data/element(*, cq:Page)[ (jcr:contains(., 'courses'))] option (index tag customSearch)
    • 等效的查詢產生器API查詢: fulltext=courses
      type=cq:Page
      path=/content/mysite
      p.limit=10
      p.indexTag=customSearch
  5. 執行更新的查詢,以驗證與指定的自訂索引(customSearch)一致且正確的結果。

相關讀數

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f