Answers.Body: <p>It's more &quot;filtering&quot; than &quot;searching&quot;, but take a look at this...</p>
  <blockquote>
  <p><a href="https://plugins.doublesecretagency.com/smart-map/filtering-entries-by-subfield-value/" rel="nofollow noreferrer">Filtering entries by subfield value</a></p>
  </blockquote>
  <p>Set a <code>filter</code> parameter when creating your element criteria model...</p>
  <pre><code>{% set params = {
      filter: {
          city: 'Beverly Hills',
          state: 'CA'
      }
  } %}
  
  {% set meetings = craft.entries.address(params) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-18T19:52:26.567Z
Answers.Text: Perfect! Thanks. Follow up...If I wanted to filter just by cities and group them so my 10 meetings in Beverly Hills just appears as on listing for Beverly Hills how would I do that with the "set params = " syntax?
Answers.UserDisplayName: Eric Snyder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-19T19:12:06.410Z
Answers.Text: I'm not sure I follow. You may want to [ask a new question](https://craftcms.stackexchange.com/questions/ask) and go into a bit more detail.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-19T22:32:25.713Z
Answers.Text: New question posted here. Hopefully clearer. :)  https://craftcms.stackexchange.com/questions/25270/getting-unique-values-from-smartmap-addresses
Answers.UserDisplayName: Eric Snyder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-03-18T06:31:56.187Z
Answers.LastActivityDate: 2021-01-01T07:02:27.383Z
Answers.LastEditDate: 2021-01-01T07:02:27.383Z
Answers.UserDisplayName: Lindsey D
Body: <p>I have entries using the Smart Map address field. I need to get just the entries that have a combination of city and state (city = &quot;Beverly Hills&quot; AND state = &quot;CA&quot;). I am currently only trying to get simpler search state working and only then will I move to state/city. I can get a &quot;fuzzy&quot; that to my understanding will get everything that has &quot;CA&quot; in any of the fields using:</p>
  <pre><code>{% set meetings = craft.entries.section('meetings').search('address:' ~ 'CA') %}
  </code></pre>
  <p>But I want to understand how to create a more specific search that specifically finds 'CA' in address.state.</p>
  <p>When I try:</p>
  <pre><code>{% set meetings = craft.entries.section('meetings').search('address.state:' ~ 'CA') %}
  </code></pre>
  <p>the search returns nothing. No errors either.</p>
  <p>Questions:</p>
  <ul>
  <li>How do I search specifically in a field like address.state?</li>
  <li>Extending this question, how do I search address.state AND address.city?</li>
  </ul>
  
Tags: <search><plugin-smartmap>
Title: Smart Map - How to search by a field in address?
ThreadText: # Smart Map - How to search by a field in address?
  
  (Asked by: username_0 on 2018-03-17)
  
  I have entries using the Smart Map address field. I need to get just the entries that have a combination of city and state (city = "Beverly Hills" AND state = "CA"). I am currently only trying to get simpler search state working and only then will I move to state/city. I can get a "fuzzy" that to my understanding will get everything that has "CA" in any of the fields using:
  
  ```
  {% set meetings = craft.entries.section('meetings').search('address:' ~ 'CA') %}
  
  ```
  
  But I want to understand how to create a more specific search that specifically finds 'CA' in address.state.
  
  When I try:
  
  ```
  {% set meetings = craft.entries.section('meetings').search('address.state:' ~ 'CA') %}
  
  ```
  
  the search returns nothing. No errors either.
  
  Questions:
  
  * How do I search specifically in a field like address.state?
  * Extending this question, how do I search address.state AND address.city?
  
  **Tags:** search, plugin-smartmap
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-18. Score: 2 | Accepted answer
  
  It's more "filtering" than "searching", but take a look at this...
  
  > [Filtering entries by subfield value](https://plugins.doublesecretagency.com/smart-map/filtering-entries-by-subfield-value/)
  
  Set a `filter` parameter when creating your element criteria model...
  
  ```
  {% set params = {
      filter: {
          city: 'Beverly Hills',
          state: 'CA'
      }
  } %}
  
  {% set meetings = craft.entries.address(params) %}
  
  ```
  
  > **Comments:**
  > **username_0**: Perfect! Thanks. Follow up...If I wanted to filter just by cities and group them so my 10 meetings in Beverly Hills just appears as on listing for Beverly Hills how would I do that with the "set params = " syntax?  
  > **username_1**: I'm not sure I follow. You may want to [ask a new question](https://craftcms.stackexchange.com/questions/ask) and go into a bit more detail.  
  > **username_0**: New question posted here. Hopefully clearer. :)  https://craftcms.stackexchange.com/questions/25270/getting-unique-values-from-smartmap-addresses  
  
  ---
  
  