<?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>DXP Search Customization with ModelPreFilterContributor</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=118450207" />
  <subtitle>DXP Search Customization with ModelPreFilterContributor</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=118450207</id>
  <updated>2026-04-06T20:11:33Z</updated>
  <dc:date>2026-04-06T20:11:33Z</dc:date>
  <entry>
    <title>RE: DXP Search Customization with ModelPreFilterContributor</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120492066" />
    <author>
      <name>Gopal Prasad Satapathy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120492066</id>
    <updated>2020-12-08T07:34:41Z</updated>
    <published>2020-12-08T07:34:41Z</published>
    <summary type="html">&lt;p&gt;How can this be added to only the default search bar module ?&lt;/p&gt;</summary>
    <dc:creator>Gopal Prasad Satapathy</dc:creator>
    <dc:date>2020-12-08T07:34:41Z</dc:date>
  </entry>
  <entry>
    <title>RE: DXP Search Customization with ModelPreFilterContributor</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118871727" />
    <author>
      <name>Gopal Prasad Satapathy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118871727</id>
    <updated>2020-04-07T06:44:40Z</updated>
    <published>2020-04-07T06:44:40Z</published>
    <summary type="html">Hello,&lt;br /&gt;Am still looking for an answer. Any pointer would be of great help.&lt;br /&gt;Thanks,&lt;br /&gt;Gopal</summary>
    <dc:creator>Gopal Prasad Satapathy</dc:creator>
    <dc:date>2020-04-07T06:44:40Z</dc:date>
  </entry>
  <entry>
    <title>RE: DXP Search Customization with ModelPreFilterContributor</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118860295" />
    <author>
      <name>Gopal Prasad Satapathy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118860295</id>
    <updated>2020-04-06T08:16:58Z</updated>
    <published>2020-04-06T08:16:58Z</published>
    <summary type="html">Hello,Can i get any help on this.&lt;em&gt;&lt;strong&gt;My requirement is to restrict images from showing up in the search result when search is performed only from the default search bar module , but not from any other search available like searching in Document and Media.&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Thanks,Gopal</summary>
    <dc:creator>Gopal Prasad Satapathy</dc:creator>
    <dc:date>2020-04-06T08:16:58Z</dc:date>
  </entry>
  <entry>
    <title>RE: DXP Search Customization with ModelPreFilterContributor</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118616476" />
    <author>
      <name>Gopal Prasad Satapathy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118616476</id>
    <updated>2020-02-28T08:51:32Z</updated>
    <published>2020-02-28T08:51:32Z</published>
    <summary type="html">Hello David,Thanks for your reply.My requirement is to restrict images from showing up in the search result when search is performed only from the default search bar module , but not from any other search available like searching in Document and Media.&lt;br /&gt;Thanks,Gopal</summary>
    <dc:creator>Gopal Prasad Satapathy</dc:creator>
    <dc:date>2020-02-28T08:51:32Z</dc:date>
  </entry>
  <entry>
    <title>RE: DXP Search Customization with ModelPreFilterContributor</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118452140" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118452140</id>
    <updated>2020-02-07T06:46:25Z</updated>
    <published>2020-02-07T06:46:25Z</published>
    <summary type="html">That filter is not selective. If you tell it to exclude, it is going to exclude.&lt;br /&gt;&lt;br /&gt;Instead I&amp;#39;d be move this elsewhere, like maybe tacked onto the keyword contributor or even decorate the portlet itself.</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2020-02-07T06:46:25Z</dc:date>
  </entry>
  <entry>
    <title>DXP Search Customization with ModelPreFilterContributor</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118450206" />
    <author>
      <name>Gopal Prasad Satapathy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118450206</id>
    <updated>2020-02-07T06:22:08Z</updated>
    <published>2020-02-07T06:22:08Z</published>
    <summary type="html">Hello,&lt;br /&gt;Following is the  ModelPreFilterContributor  code which has been written to restrict images from showing up in the search result.&lt;br /&gt;But the problem that we see now is,  it even restricts the images to appear in the search result when we try to search for an image in the search bar that is available inside Site-&amp;gt;Document and Media. &lt;br /&gt;Is there a way possible to restrict the file from the search result when we search from the normal search bar but to allow from the search bar that is available in Document and Media?&lt;br /&gt;&lt;br /&gt;&lt;em&gt;@Component(&lt;br /&gt;immediate = true, property = &amp;#34;indexer.class.name=com.liferay.document.library.kernel.model.DLFileEntry&amp;#34;,&lt;br /&gt;service = com.liferay.portal.search.spi.model.query.contributor.ModelPreFilterContributor.class&lt;br /&gt;)&lt;/em&gt;&lt;br /&gt;&lt;em&gt;​​​​​​​&lt;/em&gt;&lt;em&gt;public class ModelPreFilterContributor&lt;br /&gt;implements com.liferay.portal.search.spi.model.query.contributor.&lt;br /&gt;ModelPreFilterContributor {&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;@Override&lt;br /&gt;public void contribute(&lt;br /&gt;BooleanFilter booleanFilter, ModelSearchSettings modelSearchSettings,&lt;br /&gt;SearchContext searchContext) {&lt;br /&gt;TermsFilter filter = new TermsFilter(&amp;#34;extension&amp;#34;);&lt;br /&gt;filter.addValues(&amp;#34;jpeg&amp;#34;, &amp;#34;jpg&amp;#34;, &amp;#34;png&amp;#34;,&amp;#34;tif&amp;#34;,&amp;#34;gif&amp;#34;,&amp;#34;bmp&amp;#34;,&amp;#34;psd&amp;#34;);&lt;br /&gt;booleanFilter.add(filter, BooleanClauseOccur.MUST_NOT);&lt;br /&gt;}&lt;/em&gt;&lt;em&gt;}&lt;/em&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Gopal</summary>
    <dc:creator>Gopal Prasad Satapathy</dc:creator>
    <dc:date>2020-02-07T06:22:08Z</dc:date>
  </entry>
</feed>
