Uploaded image for project: 'Hippo Site Toolkit 2'
  1. Hippo Site Toolkit 2
  2. HSTTWO-4270

Search Generic Content REST API doesn't work through preview mount

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 5.0.4, 5.1.1, 5.2.0
    • Fix Version/s: 5.3.0
    • Component/s: None
    • Labels:
      None
    • Similar issues:
    • Processed by team:
      Turing
    • Sprint:
      Turing Sprint 178

      Description

      If you add a /preview/api mount with @hst:type="preview" with the specific named pipeline (e.g, http://localhost:8080/site/preview/api/documents), it doesn't work correctly (doesn't show all documents that it should) because of a very simple problem.

      I found the query it is using in preview mode through HST diagnostics:

      //element(*,hippo:document)[(@hippo:paths='6b3783ce-2ca6-4dc2-b592-e540f5a6e74e') 
      and ((@hippo:availability = 'preview') and (@hippostdpubwf:publicationDate))] 
      order by @hippostdpubwf:publicationDate descending
      

      The problem is that there is no "hippostdpubwf:publicationDate" in the unpublished (preview) variant node, but the query generated/used in the product has the constraint like "and (@hippostdpubwf:publicationDate)", and it cannot query anything as a result.

      "hippostdpubwf:publicationDate" property exists only in the "published" variant if you take look into those through console.

      In preview mode, the query should not add "hippostdpubwf:publicationDate" constraint at all.

      By the way, please be warned when testing this problem with a simple archetype generated project because the simple project has only published variant which has hippo:availability=['live', 'preview'] together. You must test this problem only on republished content documents only (e.g, by editing and republishing the documents and so having preview and live variants separately).

      And strange enough, if I append a query string like this, the preview API call returns data.
      http://localhost:8080/site/preview/api/documents?_orderBy=hippostdpubwf:lastModificationDate

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                wko Woonsan Ko
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: