<?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>Liferay 7.1 - Filtering search results by specific custom field</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111612319" />
  <subtitle>Liferay 7.1 - Filtering search results by specific custom field</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111612319</id>
  <updated>2026-04-04T12:04:33Z</updated>
  <dc:date>2026-04-04T12:04:33Z</dc:date>
  <entry>
    <title>RE: Liferay 7.1 - Filtering search results by specific custom field</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111683640" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111683640</id>
    <updated>2018-11-28T02:02:28Z</updated>
    <published>2018-11-28T02:02:28Z</published>
    <summary type="html">Hahaha love it when that happens. I can't even count the number bet of
things I've learned about Liferay that started with me stumbling into
something :). Thanks for sharing! </summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2018-11-28T02:02:28Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 - Filtering search results by specific custom field</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111683198" />
    <author>
      <name>Amos Fong</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111683198</id>
    <updated>2018-11-27T19:33:03Z</updated>
    <published>2018-11-27T19:33:03Z</published>
    <summary type="html">&lt;p&gt;Andrew,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I'm not sure, I just found it myself while looking for something else :)&lt;/p&gt;</summary>
    <dc:creator>Amos Fong</dc:creator>
    <dc:date>2018-11-27T19:33:03Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 - Filtering search results by specific custom field</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111681784" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111681784</id>
    <updated>2018-11-27T16:51:30Z</updated>
    <published>2018-11-27T16:51:30Z</published>
    <summary type="html">&lt;p&gt;Hey Amos, &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I just checked your link -- very cool! Is that something that is new
  to 7.1?&lt;/p&gt;</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2018-11-27T16:51:30Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 - Filtering search results by specific custom field</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111681446" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111681446</id>
    <updated>2018-11-27T16:49:01Z</updated>
    <published>2018-11-27T16:49:01Z</published>
    <summary type="html">&lt;p&gt;Hi Jan,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Usually when I I want to accomplish something like this I would use
  the setBooleanClauses() method on teh search context, rather than
  changing the keywords that the user entered. It's still working with
  the searchContext (as you are right now) but you would do something
  like ..&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt;
BooleanClause expandoClause = BooleanClauseFactoryUtil.create(&amp;lt;expando field name&amp;gt;, &amp;lt;your value&amp;gt;,BooleanClauseOccur.MUST.toString());
searchContext.setBooleanClauses(new BooleanClause[]{expandoClause});&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;That usually works for me. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2018-11-27T16:49:01Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 - Filtering search results by specific custom field</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111676566" />
    <author>
      <name>Amos Fong</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111676566</id>
    <updated>2018-11-26T22:36:27Z</updated>
    <published>2018-11-26T22:36:27Z</published>
    <summary type="html">&lt;p&gt;For searching by expandos, maybe try something similar to this?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;https://github.com/liferay/liferay-portal/blob/master/modules/apps/portal-search/portal-search-test-util/src/main/java/com/liferay/portal/search/test/util/expando/BaseExpandoTestCase.java#L303&lt;/p&gt;</summary>
    <dc:creator>Amos Fong</dc:creator>
    <dc:date>2018-11-26T22:36:27Z</dc:date>
  </entry>
  <entry>
    <title>Liferay 7.1 - Filtering search results by specific custom field</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111612318" />
    <author>
      <name>Jan Tošovský</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111612318</id>
    <updated>2018-11-20T17:05:34Z</updated>
    <published>2018-11-20T17:05:34Z</published>
    <summary type="html">&lt;p&gt;In LR 6.2 I could filter the results by modifying the search context
  this way:&lt;/p&gt;
&lt;pre&gt;
searchContext.setKeywords(keywords + &amp;quot; AND expando/custom_fields/region:&amp;quot; + myRegion);&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;In ElasticSearch custom fields are named differently, but this
  doesn't work (returns no results):&lt;/p&gt;
&lt;pre&gt;
searchContext.setKeywords(keywords + &amp;quot; AND expando__custom_fields__region:&amp;quot; + myRegion);&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;How this kind of filter can be accomplished? (I am customizing the
  User Admin search code).&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Jan Tošovský</dc:creator>
    <dc:date>2018-11-20T17:05:34Z</dc:date>
  </entry>
</feed>
