0

Had a bit of a search through the different questions on here already but it seems that nothing matches what I'm after. Using the example template from the documentation i can get low search working just fine with keywords only.

My issue however is that i need to be able to search both entry title (keywords) AND category. For example - searching all entries that contain the keyword "manager" but also the category of "north london".

I have a single collection which looks at the correct channel and what not but i still feel like I'm missing something.

Is this something that is possible with low search? or am I just being blind and or misinterpreting the documentation.

Template code below:

           {exp:low_search:form required="keywords"}
                <div class="row">
                    <div class="large-5 medium-5 columns">
                        <input type="search" name="keywords" placeholder="Job title / Keywords" />
                    </div>

                    <div class="large-5 medium-5 columns">
                        <select name="category[]" class="search-location">
                            <option value="">Location</option>

                            {exp:channel:categories category_group="5" style="linear"}
                                <option value="{category_id}"{if low_search_category ~ '/\b'.category_id.'\b/'} selected{/if}>
                                    {category_name}
                                </option>
                            {/exp:channel:categories}
                        </select>
                    </div>

                    <div class="large-2 medium-2 columns">
                        <button type="submit">Search</button>
                    </div>
                </div>
            {/exp:low_search:form}

EDIT: Added results tag below:

{exp:low_search:results query="{segment_3}" channel="practice-careers" keywords:lang="en" keywords:inflect="yes" limit="10"}
3
  • Can you include a simplified version of your exp:low_search:results tag as well? Jul 3 '17 at 17:17
  • Your code doesn't show anything out of the ordinary. Not defining a collection simply searches all collections (which is later filtered down to the given channel). If you're getting unexpected (or no) results, try enabling the template debugger and look up all lines that mention Low Search -- that might give to more insight as to what is happening.
    – Low
    Jul 4 '17 at 9:12
  • Thanks for all the comments guys. I replaced my results tag with the one from @pixldev updating with my own collection name and minus the lang which seemed to do the trick. Jul 4 '17 at 10:30
0

I have a very similar search form on my site with keywords, categories, and additional fields for further search refinement.

I noticed one major difference though - my result page doesn't use a channel parameter, I am using the collection parameter to set the data source.

{exp:low_search:results
    status="open"
    query="{segment_3}"
    collection="products"
    collection_lang="ja"
    keywords:mode="any"
    keywords:loose="both"
    limit="30"
}

My search result tags are somewhat specific to Japanese language, hence the keywords:mode settings. However, if you have already set a collection, it might be best to specify the collection in the tags instead of a channel.

1
  • Thanks, I shall give that a bit of a whirl and see how far i get :) Jul 4 '17 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.