Answers.Body: <p>Author of Smart Map here... I can't tell exactly what question you are asking, so I'll give an answer based on my understanding of the problem.</p>
  <p>It looks like your biggest problem is here:</p>
  <pre><code>    {% set criteria = {
          section: 'jobListings',
          state: state,
          truckType: trucktype,
          city: city,
          jobAddress: {
              zip: target
          }
      } %}
  </code></pre>
  <p>If you are trying to filter by the <code>state</code>, <code>city</code>, and <code>zip</code> of the <strong>jobAddress</strong> field, then those will need to be contained in a <code>filter</code> parameter...</p>
  <pre><code>    {% set criteria = {
          section: 'jobListings',
          truckType: trucktype,
          jobAddress: {
              filter: {
                  state: state,
                  city: city,
                  zip: target
              }
          }
      } %}
  </code></pre>
  <p>Check out the docs on <a href="https://plugins.doublesecretagency.com/smart-map/filtering-entries-by-subfield-value/" rel="nofollow noreferrer">Filtering entries by subfield value</a> for more information. Hope that helps!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-30T22:02:39.277Z
Answers.LastActivityDate: 2021-01-01T07:28:24.633Z
Answers.LastEditDate: 2021-01-01T07:28:24.633Z
Answers.UserDisplayName: Lindsey D
Body: <p>I am trying to complete an advanced search query with Smart Map, but I can't seem to quite get it. I tried to merge several URL parameters, and they seem to work fine except when it comes down to Smart Map's query.</p>
  <p>I followed along with the example <a href="https://plugins.doublesecretagency.com/smart-map/sorting-entries-by-closest-locations/" rel="nofollow noreferrer">here</a>, but it's not fully rendering correctly. The Smart Map field is named <code>jobAddress</code>, in the section called <code>jobListings</code>.</p>
  <p>Can anyone take a peek at my code and perhaps point out what I am doing wrong? Disclaimer... I am extremely new to Craft. I appreciate your help and guidance!</p>
  <pre class="lang-html prettyprint-override"><code>{% extends &quot;_layout&quot; %}
  
  {% block main %}
  
      {# Set variables for each possible param: #}
      {% set state = craft.app.request.getParam('state') %}
      {% set trucktype = craft.app.request.getParam('trucktype') %}
      {% set city = craft.app.request.getParam('city') %}
      {% set target = craft.app.request.getParam('zip') %}
      {% set range = craft.app.request.getParam('range') %}
  
      {# Here we set the criteria and combine all the parameter variables #}
      {% set criteria = {
          section: 'jobListings',
          state: state,
          truckType: trucktype,
          city: city,
          jobAddress:{
              zip:target
          }
      } %}
  
      {# Pass the criteria object to the query builder: #}
      {% set query = craft.entries(criteria) %}
  
      {% if target is not empty and range is not empty %}
          {% set query = query|merge({
              jobAddress:{
                  range: range
              }
          }) %}
      {% endif %}
  
      {# We build the map location based on criteria #}
      &lt;div class=&quot;container-fluid&quot; id=&quot;map&quot;&gt;
          &lt;div class=&quot;row bg-secondary&quot;&gt;
              &lt;div class=&quot;col-sm-12 p-0&quot;&gt;
                  {% set locations = query %}
                  {% set options = {
                      height:400,
                      zoom: 5,
                      'markerInfo': 'searchjobs/infoBubble',
                      markerOptions: {
                          icon: 'https://maps.google.com/mapfiles/ms/icons/green-dot.png'
                      }
                  } %}
                  {{ craft.smartMap.map(locations, options) }}
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      {# DISPLAY Search Results #}
      &lt;div class=&quot;container-fluid pt-5 pb-1 jobs-index&quot;&gt;
          &lt;h1 class=&quot;text-center&quot;&gt;Search Results&lt;/h1&gt;
          {# Set up pagination, and let it grab the current page's results: #}
          {% paginate query as pageInfo, results %}
  
          {% for result in results %}
              &lt;div class=&quot;row p-4&quot;&gt;
                  &lt;div class=&quot;col-sm-8 offset-sm-2 col-md-6 offset-md-3 bg-light p-2&quot;&gt;
                      &lt;h3 class=&quot;job-header&quot;&gt;{{ result.title }}&lt;/h3&gt;
                      &lt;p&gt;&lt;strong&gt;&lt;em&gt;Truck:&lt;/em&gt;&lt;/strong&gt; {{ result.truckType }}&lt;/p&gt;
                      &lt;p&gt;&lt;strong&gt;&lt;em&gt;State&lt;/em&gt;&lt;/strong&gt;{{ result.state}}&lt;/p&gt;
                      &lt;p&gt;&lt;strong&gt;&lt;em&gt;City:&lt;/em&gt;&lt;/strong&gt; {{ result.city}}&lt;/p&gt;
                      &lt;a class=&quot;btn btn-small btn-details&quot; href=&quot;/jobs/{{result.slug}}&quot;&gt;Get More Details &amp;nbsp; &lt;i class=&quot;fas fa-arrow-right&quot;&gt;&lt;/i&gt; &lt;/a&gt;
                      &lt;p class=&quot;pt-2&quot;&gt;&lt;strong&gt;Benefits: &lt;/strong&gt;
                          {% for option in result.jobBenefits %}
                              {{ option.value }}
                              {# Value: {{ option }} or {{ option.value }} #}
                          {% endfor %}
                      &lt;/p&gt;
                      {# Show the Radius #}
                      &lt;p&gt;&lt;strong&gt;{{ result.jobAddress.distance | number_format(1) }} miles away&lt;/strong&gt;&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          {% endfor %}
  
          &lt;div class=&quot;search-again&quot;&gt;
              &lt;h3 class=&quot;text-center&quot;&gt;Didn't find what you're looking for?&lt;/h3&gt;
              &lt;a class=&quot;btn btn-lg btn-success search-again-btn&quot; href=&quot;/jobs&quot;&gt;Search Again&lt;/a&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  {% endblock %}
  
  </code></pre>
  <p>Here is a live preview of the <a href="https://conversionia.frb.io/jobs" rel="nofollow noreferrer">current site...</a></p>
  
Tags: <query><plugin-smartmap>
Title: Advanced Search Filter
ThreadText: # Advanced Search Filter
  
  (Asked by: username_0 on 2020-01-23)
  
  I am trying to complete an advanced search query with Smart Map, but I can't seem to quite get it. I tried to merge several URL parameters, and they seem to work fine except when it comes down to Smart Map's query.
  
  I followed along with the example [here](https://plugins.doublesecretagency.com/smart-map/sorting-entries-by-closest-locations/), but it's not fully rendering correctly. The Smart Map field is named `jobAddress`, in the section called `jobListings`.
  
  Can anyone take a peek at my code and perhaps point out what I am doing wrong? Disclaimer... I am extremely new to Craft. I appreciate your help and guidance!
  
  ```html
  {% extends "_layout" %}
  
  {% block main %}
  
      {# Set variables for each possible param: #}
      {% set state = craft.app.request.getParam('state') %}
      {% set trucktype = craft.app.request.getParam('trucktype') %}
      {% set city = craft.app.request.getParam('city') %}
      {% set target = craft.app.request.getParam('zip') %}
      {% set range = craft.app.request.getParam('range') %}
  
      {# Here we set the criteria and combine all the parameter variables #}
      {% set criteria = {
          section: 'jobListings',
          state: state,
          truckType: trucktype,
          city: city,
          jobAddress:{
              zip:target
          }
      } %}
  
      {# Pass the criteria object to the query builder: #}
      {% set query = craft.entries(criteria) %}
  
      {% if target is not empty and range is not empty %}
          {% set query = query|merge({
              jobAddress:{
                  range: range
              }
          }) %}
      {% endif %}
  
      {# We build the map location based on criteria #}
      <div class="container-fluid" id="map">
          <div class="row bg-secondary">
              <div class="col-sm-12 p-0">
                  {% set locations = query %}
                  {% set options = {
                      height:400,
                      zoom: 5,
                      'markerInfo': 'searchjobs/infoBubble',
                      markerOptions: {
                          icon: 'https://maps.google.com/mapfiles/ms/icons/green-dot.png'
                      }
                  } %}
                  {{ craft.smartMap.map(locations, options) }}
              </div>
          </div>
      </div>
  
      {# DISPLAY Search Results #}
      <div class="container-fluid pt-5 pb-1 jobs-index">
          <h1 class="text-center">Search Results</h1>
          {# Set up pagination, and let it grab the current page's results: #}
          {% paginate query as pageInfo, results %}
  
          {% for result in results %}
              <div class="row p-4">
                  <div class="col-sm-8 offset-sm-2 col-md-6 offset-md-3 bg-light p-2">
                      <h3 class="job-header">{{ result.title }}</h3>
                      <p><strong><em>Truck:</em></strong> {{ result.truckType }}</p>
                      <p><strong><em>State</em></strong>{{ result.state}}</p>
                      <p><strong><em>City:</em></strong> {{ result.city}}</p>
                      <a class="btn btn-small btn-details" href="/jobs/{{result.slug}}">Get More Details &nbsp; <i class="fas fa-arrow-right"></i> </a>
                      <p class="pt-2"><strong>Benefits: </strong>
                          {% for option in result.jobBenefits %}
                              {{ option.value }}
                              {# Value: {{ option }} or {{ option.value }} #}
                          {% endfor %}
                      </p>
                      {# Show the Radius #}
                      <p><strong>{{ result.jobAddress.distance | number_format(1) }} miles away</strong></p>
                  </div>
              </div>
          {% endfor %}
  
          <div class="search-again">
              <h3 class="text-center">Didn't find what you're looking for?</h3>
              <a class="btn btn-lg btn-success search-again-btn" href="/jobs">Search Again</a>
          </div>
      </div>
  {% endblock %}
  
  ```
  
  Here is a live preview of the [current site...](https://conversionia.frb.io/jobs)
  
  **Tags:** query, plugin-smartmap
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-01-30. Score: 1
  
  Author of Smart Map here... I can't tell exactly what question you are asking, so I'll give an answer based on my understanding of the problem.
  
  It looks like your biggest problem is here:
  
  ```
      {% set criteria = {
          section: 'jobListings',
          state: state,
          truckType: trucktype,
          city: city,
          jobAddress: {
              zip: target
          }
      } %}
  
  ```
  
  If you are trying to filter by the `state`, `city`, and `zip` of the **jobAddress** field, then those will need to be contained in a `filter` parameter...
  
  ```
      {% set criteria = {
          section: 'jobListings',
          truckType: trucktype,
          jobAddress: {
              filter: {
                  state: state,
                  city: city,
                  zip: target
              }
          }
      } %}
  
  ```
  
  Check out the docs on [Filtering entries by subfield value](https://plugins.doublesecretagency.com/smart-map/filtering-entries-by-subfield-value/) for more information. Hope that helps!
  
  
  ---
  
  