<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Getting "view in context" URL in custom search portlet</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=90304557" />
  <subtitle>Getting "view in context" URL in custom search portlet</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=90304557</id>
  <updated>2026-04-04T16:13:08Z</updated>
  <dc:date>2026-04-04T16:13:08Z</dc:date>
  <entry>
    <title>RE: Getting "view in context" URL in custom search portlet</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110674496" />
    <author>
      <name>Vishnu S Kumar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110674496</id>
    <updated>2018-08-07T19:15:08Z</updated>
    <published>2018-08-07T19:15:08Z</published>
    <summary type="html">&lt;p&gt;Did you find any solution for this?&lt;/p&gt;</summary>
    <dc:creator>Vishnu S Kumar</dc:creator>
    <dc:date>2018-08-07T19:15:08Z</dc:date>
  </entry>
  <entry>
    <title>RE: Getting "view in context" URL in custom search portlet</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=92824428" />
    <author>
      <name>Steve Weiss</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=92824428</id>
    <updated>2017-08-08T12:21:31Z</updated>
    <published>2017-08-08T12:21:31Z</published>
    <summary type="html">&lt;div class="quote-title"&gt;Marco Azzalini:&lt;/div&gt;&lt;blockquote&gt;&lt;div class="quote-title"&gt;Steve Weiss:&lt;/div&gt;&lt;blockquote&gt;No, I haven&amp;#39;t found a solution. We&amp;#39;re moving to Liferay 7 so I&amp;#39;ve been focusing on that recently.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Hi Steve, I found the solution (!) and looking at yours urls, I think you fallen on the same problem, so it should be useful also for you.&lt;br /&gt;Going back to our problem, the solution concerns the plid parameter. In my case, it turned out that after an import of one page, the new page with a different name was binded to the plid of a previous one ( I don&amp;#39;t know why, probably because the friendly url was the same). Deleting that page and importing it again did the trick ;-) &lt;br /&gt;I am not sure if this can solve also your problema but, if you still have the LR 6.2 available, give it a try and let me know.&lt;br /&gt;&lt;br /&gt;regards,&lt;br /&gt;Marco&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Marco, thank you. I will give this a try as soon as I get the chance. It sounds like it could be the same issue.</summary>
    <dc:creator>Steve Weiss</dc:creator>
    <dc:date>2017-08-08T12:21:31Z</dc:date>
  </entry>
  <entry>
    <title>RE: Getting "view in context" URL in custom search portlet</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=92815241" />
    <author>
      <name>Marco Azzalini</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=92815241</id>
    <updated>2017-08-08T09:28:14Z</updated>
    <published>2017-08-08T09:28:14Z</published>
    <summary type="html">&lt;div class="quote-title"&gt;Steve Weiss:&lt;/div&gt;&lt;blockquote&gt;No, I haven&amp;#39;t found a solution. We&amp;#39;re moving to Liferay 7 so I&amp;#39;ve been focusing on that recently.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Hi Steve, I found the solution (!) and looking at yours urls, I think you fallen on the same problem, so it should be useful also for you.&lt;br /&gt;Going back to our problem, the solution concerns the plid parameter. In my case, it turned out that after an import of one page, the new page with a different name was binded to the plid of a previous one ( I don&amp;#39;t know why, probably because the friendly url was the same). Deleting that page and importing it again did the trick ;-) &lt;br /&gt;I am not sure if this can solve also your problema but, if you still have the LR 6.2 available, give it a try and let me know.&lt;br /&gt;&lt;br /&gt;regards,&lt;br /&gt;Marco</summary>
    <dc:creator>Marco Azzalini</dc:creator>
    <dc:date>2017-08-08T09:28:14Z</dc:date>
  </entry>
  <entry>
    <title>RE: Getting "view in context" URL in custom search portlet</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=92788619" />
    <author>
      <name>Steve Weiss</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=92788619</id>
    <updated>2017-08-07T16:44:12Z</updated>
    <published>2017-08-07T16:44:12Z</published>
    <summary type="html">&lt;div class="quote-title"&gt;Marco Azzalini:&lt;/div&gt;&lt;blockquote&gt;Hi Steve, did you find any solution? I have the same problem here (Liferay 6.2) with my custom ADT.&lt;br /&gt;The weird thing is that the link for the documents worked for weeks but now, after some modifications to the page, it doesn&amp;#39;t work anymore,&lt;br /&gt; and in my case, the url generated by &lt;em&gt;assetRenderer.getURLViewInContext&lt;/em&gt;  has also the &lt;em&gt;noSuchEntry&lt;/em&gt; correctly set.&lt;br /&gt;&lt;br /&gt;Let me know if you find something useful.&lt;br /&gt;&lt;br /&gt;Marco&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;No, I haven&amp;#39;t found a solution. We&amp;#39;re moving to Liferay 7 so I&amp;#39;ve been focusing on that recently.</summary>
    <dc:creator>Steve Weiss</dc:creator>
    <dc:date>2017-08-07T16:44:12Z</dc:date>
  </entry>
  <entry>
    <title>RE: Getting "view in context" URL in custom search portlet</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=92781969" />
    <author>
      <name>Marco Azzalini</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=92781969</id>
    <updated>2017-08-07T13:52:19Z</updated>
    <published>2017-08-07T13:52:19Z</published>
    <summary type="html">Hi Steve, did you find any solution? I have the same problem here (Liferay 6.2) with my custom ADT.&lt;br /&gt;The weird thing is that the link for the documents worked for weeks but now, after some modifications to the page, it doesn&amp;#39;t work anymore,&lt;br /&gt; and in my case, the url generated by &lt;em&gt;assetRenderer.getURLViewInContext&lt;/em&gt;  has also the &lt;em&gt;noSuchEntry&lt;/em&gt; correctly set.&lt;br /&gt;&lt;br /&gt;Let me know if you find something useful.&lt;br /&gt;&lt;br /&gt;Marco</summary>
    <dc:creator>Marco Azzalini</dc:creator>
    <dc:date>2017-08-07T13:52:19Z</dc:date>
  </entry>
  <entry>
    <title>Getting "view in context" URL in custom search portlet</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=90304556" />
    <author>
      <name>Steve Weiss</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=90304556</id>
    <updated>2017-06-05T19:34:34Z</updated>
    <published>2017-06-05T19:34:34Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;I've created a custom search portlet that searches blogs, bookmarks, document library, message boards, web content, and wiki pages. The results are displayed in a table with links generated by an AssetRenderer. One of the links is for "View in Context", this link works fine for all asset types except document library entries. Clicking on the link of a document result leads to the results page simply being re-loaded. However, if my search portlet is in a different site than the Document Library portlet, the link works correctly- it takes the user to the DL portlet showing the document details.&lt;br&gt;&lt;br&gt;Here is a snippet of my code:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;AssetRenderer renderer = asset.getAssetRenderer();
PortletURL purl = renderer.getURLView((LiferayPortletResponse) response, WindowState.MAXIMIZED);
entry.setUrlView(purl);
String urlviewincontext = renderer.getURLViewInContext((LiferayPortletRequest) request, (LiferayPortletResponse) response, null);
_log.debug("urlViewInContext: " + urlviewincontext);
entry.setUrlViewInContext(urlviewincontext);
PortletURL editurl = renderer.getURLEdit((LiferayPortletRequest) request, (LiferayPortletResponse) response);
_log.debug("Edit URL: " + editurl.toString());

&lt;/code&gt;&lt;/pre&gt;The URL appears to be mostly the same as the one shown in the out of the box Liferay search portlet, except I am not setting the "noSuchEntryRedirect" parameter when I call AssetRenderer.getURLViewInContext().&lt;br&gt;&lt;br&gt;Liferay search URL:&lt;br&gt;&lt;strong&gt;http://localhost:8180/c/document_library/find_file_entry?p_l_id=20586&lt;/strong&gt;&amp;amp;noSuchEntryRedirect=http%3A%2F%2Flocalhost%3A8180%2Fweb%2Fscienceworks%2Fmain%3Fp_p_auth%3D5BDmDClj%26p_p_id%3D101%26p_p_lifecycle%3D0%26p_p_state%3Dmaximized%26p_p_mode%3Dview%26_101_struts_action%3D%252Fasset_publisher%252Fview_content%26_101_returnToFullPageURL%3D%252Fweb%252Fscienceworks%252Fmain%26_101_assetEntryId%3D20777%26_101_type%3Ddocument%26redirect%3Dhttp%253A%252F%252Flocalhost%253A8180%252Fweb%252Fscienceworks%252Fmain%253Fp_p_id%253D3%2526p_p_lifecycle%253D0%2526p_p_state%253Dmaximized%2526p_p_mode%253Dview%2526_3_redirect%253D%25252Fweb%25252Fscienceworks%25252Fmain%2526_3_keywords%253Dtest7%2526_3_groupId%253D0%2526_3_struts_action%253D%25252Fsearch%25252Fsearch&amp;amp;&lt;strong&gt;fileEntryId=20775&lt;/strong&gt;&amp;amp;inheritRedirect=true&lt;br&gt;&lt;br&gt;My URL:&lt;br&gt;http://localhost:8180/c/document_library/find_file_entry?p_l_id=20618&amp;amp;noSuchEntryRedirect=null&amp;amp;fileEntryId=20775&lt;br&gt;&lt;br&gt;Any help would be greatly appreciated.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Steve Weiss</dc:creator>
    <dc:date>2017-06-05T19:34:34Z</dc:date>
  </entry>
</feed>
