Get pages where a document has been used


#1

Hi All,

I want to retrieve a document based on search key and need to find all the pages where this document is being used. I tried with fluent search, it gives me the document with the search and on search result page i also get the page link where this document is used(through <@hst.link var=“link” hippobean=item />).

However, if the same document is used for two pages, it still just return one result. For my requirement it should return me 2 results and with their link for page. Can you please help, how could i achieve this?

Also, is there a way to get the page in my searchComponent itself(java class).

Thanks
Rahul


#2

use HstLinkCreator.createAll() method


#3

It worked. Thanks a lot.

Rahul


#4

Hi Machak,

I want to capture the pages where a document has been used, but at the time when the document gets published. How can i get that please suggest. I get requestContext null in CMS module.

Thanks
Rahul


#5

see this thread:

You need to get hold of HST request, so, you’ll need to call some REST service which will handle this for you.


#6

Thanks Machak.

I can get this working in case of document publish, where I can get UUID and path of the document published. But can you suggest me how do can I get the url(sitemap) of page being published through channel-manager? For event category “channel-manager” and event action “publishMount”.


#7

You can use HstLinkCreator for that too, see create methods which take path (string) as an argument


#8

But this event does not gives me the path of the page which has been published. Can you please tell me how do i get the path from the event?

Thanks
Rahul


#9

you have UUID of the document, so you can get the (JCR) Node, use methods which create URL based on that, also listed in HstLinkCreator


#10

I am not talking here about document publish. I am talking about page publish through channel manager.

Thanks
Rahul


#11

There are channel manager events on this page: https://documentation.bloomreach.com/library/concepts/channels/overview-of-channel-manager-events-and-response-mechanisms.html


#12

well, you are publishing the channel and a page. So, only way would be to loop through all pages on that channel, event itself has no data about changed/published pages.