I am creating a faceted search using Low Search with the help of this post. I would like to include a list of years as a facet, too, but I only want years listed where there is an entry. For example, if I had an entries in 2004, 2005, 2007, 2010 and 2014, I'd want those to be what displays, but not 2006, 2008, 2009, etc. I'm stumped.
UPDATE APRIL 10: I've made some headway! Using Low's "Ranges" examples (scroll down to "Show entries for a given month"), I created my list of years. I'd really like to be able to generate the range dynamically so that I don't have to manually change the range every year. I created a low variable that outputs the year, but when I use it as the parameter value it creates a list of numbers starting from zero.
Here's my search code with the manual range that works:
{exp:low_search:form form_id="search" result_page="docs/index" query="{segment_2}"}
…other facets…
<fieldset>
<legend>Year</legend>
{exp:low_list:each items="2014|2003" as="year" range="yes"}
<label>
<input type="checkbox" name="year" value="{year}"{if low_search_year == year} checked{/if} />
{year}
</label>
{/exp:low_list:each}
</fieldset>
<input type="submit" class="btn btn-small" value="Filter" />
{/exp:low_search:form}
And here's my search code with the low variable used in the range, which outputs a list of numbers starting at 0 (the variable when not used as a parameter value outputs just fine):
{exp:low_search:form form_id="search" result_page="docs/index" query="{segment_2}"}
…other facets…
<fieldset>
<legend>Year</legend>
{exp:low_list:each items="{exp:low_variables:single var='lv_var_doc_library_published_year' preparse:var_doc_library_sort='desc'}|2003" as="year" range="yes"}
<label>
<input type="checkbox" name="year" value="{year}"{if low_search_year == year} checked{/if} />
{year}
</label>
{/exp:low_list:each}
</fieldset>
<input type="submit" class="btn btn-small" value="Filter" />
{/exp:low_search:form}
Does anybody have any ideas about how I can dynamically populate the parameter value?