Need help using Low Search via GET request
I'm trying to implement the Low Search via the Get request. Now, according to the docs, query="{segment_3}" is not needed when doing this. However, when I remove this from the search results page, the page always dispalys a list of items, that I'm not searching for. The search seems to work just fine when I use the encoded URI option, however, for this project, that is not an option. I need to be able to set the keywords via a get request.
Here's an example of my searchpage.html, which you can tell, has the form and the results, in the same page:
{exp:low_search:form collection="all" search_mode="all" result_page="v1/lowsearch"}
Keywords
Search
{/exp:low_search:form}
{exp:low_search:results query="{segment_3}" limit="10"}
{if count == 1}
- {/if}
- {title}
{if count == total_results}
{if no_results}No search results{/if}
{/exp:low_search:results}
Now, if I remove the query="{segment"} from the above, the search fails to work, and I always get a list of results, no matter what keyword I enter.
Any suggestions?
Thanks,
Replies
Low 7 May 2013 18:28
As mentioned in the docs, not all EE installes are capable to use the query string like this. We need to check a couple of things.
First, in your config file, what is the $config['uri_protocol'] set to?
Secondly, if you're using .htaccess to hide index.php from the URL, what does the mod_rewrite rules look like? If you're not hiding index.php form the URL, what does the full search results url look like?
Thirdly, if you add the variable {low_search_query_string} to the Results tag, what does that return?
James Lukensow 7 May 2013 18:31
Okay, so when adding {low_search_query_string} inside the results tag, it displays:
?collection=all&search_mode=all&keywords=beef
My .htaccess file:
RewriteEngine On
# Removes index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
And from the config:
$config['uri_protocol'] = 'PATH_INFO';
Low 7 May 2013 18:39
With those settings, I get search results just fine in my testing environment.
Can I take a look myself? I would need SuperAdmin and FTP access to debug properly. You can send login credentials to hi at gotolow dot com.
James Lukensow 7 May 2013 18:59
Sent a email...
James Lukensow 7 May 2013 19:26
Thanks to Low on this one, turned out it was a caching issue:
Changed
$env_config['enable_sql_caching'] = 'y';
to
$env_config['enable_sql_caching'] = 'n';