Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

For large CMS websites it's crucial for users to be able to find relevant content using Search page. Unfortunately in current implementation the actual page text (what's inside content blocks) isn't used during search which might result from page relevance indicator drop (in search results) to not even showing needed page.

Solution

  1. add new "l1_PageContent" column to the "PageRevisions" table
  2. collect text only (remove all HTML markup) from all page content blocks (on content block add/edit/delete) - the "PageContent.l1_Content" column
  3. put it into newly added "PageRevisions.l1_PageContent" column
  4. add new setting to "Configuration > Website > Search" page to represent relevance (in search results) for "PageRevisions.l1_PageContent" of currently approved page revision

...

  1. create "PageHelper::getRevisionContent($page_revision_id)" method, that will: - 0.5h
    1. get contents of all content blocks (they belong to single page) in a given revision
    2. process content from each language separately
    3. combine content block content using space and ignoring empty values
    4. call the "html_entity_decode" function with same arguments as "htmlspecialchars_decode" in "kUtil::unescape" (replaces " " and similar things with searchable equivalents)
    5. call the "strip_tags" (removed HTML tags)
    6. return associative array, where each key would be in "lX_PageContent" format (X is language ID) and value would be searchable revision content on that language
  2. add "lX_PageContent" column (X is language id) to the "PageRevisions" table: - 0.5h
    1. add multi-lingual field declaration in the unit config
    2. create "CoreUpgrades::Upgrade_5_2_2_B3" method (see similar methods in that class), that will only when "$mode == 'after'":
      1. call "\kMultiLanguageHelper::createFields" method to create new multilingual fields in "PageRevisions" table
      2. populate created fields using "PageHelper::getRevisionContent" method for each of existing page revisions
  3. create "page-revision:OnAfterPageContentChangedHook" event, that will: - 0.5h
    1. be a hook to "content:OnAfterItemCreate", "content:OnAfterItemUpdate" and "content:OnAfterItemDelete" events
    2. load page revision object associated with affected content block
    3. call "PageHelper::getRevisionContent" method to rebuild content
    4. store above retrieved content to loaded page revision in database
  4. add record to "SearchConfig" table to: - 0.5h
    1. appear in "Configuration > Website > Search" section
    2. make "PageRevisions.lX_PageContent" (X is language ID) of currently approved page revision (the Revision number (NOT ID) is stored in "Categories.LiveRevisionNumber" column)

Quote: 2h*1.4 = 3h

Related Tasks

Jira Legacy
serverSystem Jira
serverId513b375f-8291-3313-9d9f-704c39b1f915
keyINP-1744