Skip to content

Instantly share code, notes, and snippets.

@everdaniel
Created October 27, 2013 19:53
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save everdaniel/7187184 to your computer and use it in GitHub Desktop.
Save everdaniel/7187184 to your computer and use it in GitHub Desktop.
Return Low Search results as JSON
{
{exp:low_search:results query="{segment_3}" limit="10"}
{if count == 1}
"search_keywords": "{low_search_keywords}",
"total_results": {total_results},
{/if}
{if count == 1}
"results": [
{/if}
{
"title": "{title}",
"excerpt": "{low_search_excerpt}",
"url": {if low_search_collection_name == 'services'}"{path='{low_search_collection_name}/{categories}{category_url_title}{/categories}/{url_title}'}"{if:else}"{path='{low_search_collection_name}/{url_title}'}"{/if}
}
{if count != total_results},{/if}
{if count == total_results}
]
{/if}
{if no_results}
"results_found": false
{if:else}
"results_found": true
{/if}
{/exp:low_search:results}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment