Search via url query/keyword in json feed
Hey! Is the following possible Using Low Search in a json feed?
1. A standard keyword search by calling a URL like this:
domain.com/json/search/SomeKeyword
2. An advanced search for instance to search for a specific Author:
domain.com/json/author/SomeAuthor
3. And by Date:
domain.com/json/date/05 -> All posts from 2013
domain.com/json/date/2013/05 -> All posts from May 2013
domain.com/json/date/2013/05/27 -> All posts from the 27th of May 2013
Thanks!
Replies
Low 28 May 2013 14:57
Unless you want to do a lot of hardcoding, then no, this isn't possible.
Low Search requires either the encoded query in the URI, or can use GET variables, but only in the format it generates using, for example, the URL tag.
info 28 May 2013 15:07
When you say GET variables, but only in the format it generates using, for example, the URL tag, can you elaborate, sorry I'm new to this...
Thanks!
Low 28 May 2013 15:10
Here's what Low Search URIs look like, depending on whether the query is encoded or not: http://gotolow.com/addons/low-search/...
If not encoded (thus using GET variables), the query in the URI will need to use parameter values like mentioned here: http://gotolow.com/addons/low-search/...
The REST-like URLs you mention aren't possible.
info 28 May 2013 15:20
So basic keyword searches via the url is possible with GET variables e.g. domain.com/search/results?keywords=hello+world just not the advanced stuff I want to do?
Thanks!
Low 28 May 2013 15:27
If your EE setup allows for GET vars, then yes, you could create filters like this:
Keyword searches
domain.com/search/results?keywords=hello+world
...which uses Low Search's keyword parameter.
Author
domain.com/search/results?author_id=1
...using the native author_id parameter.
Dates
domain.com/search/results?year=2013&month=05&day=27
...using the native year, month and day parameters.
info 28 May 2013 15:41
OK brilliant! So the REST-like URLs you were saying weren't possible were you referring to the fact that they were very "clean" looking as apose to something like thisdomain.com/search/results?year=2013&month=05&day=27
I'm not to worried how they look that was just an example, my main concern is that I can do all those advanced searches via a url query and your saying that's possible as long as the server supports GET vars? Aplogies for being redundant.
Low 28 May 2013 15:55
Exactly. The clean URLs aren't possible.
Depending on what fits your need, you can also generate the URLs using Low Search's URL tag. So something like this:
{exp:low_search:url keywords="foo" author_id="1"}
will result in a URL like
domain.com/search/results?keywords=foo&author_id=1
...depending on whether you're encoding the queries or not.
info 28 May 2013 16:08
1. But if GET vars are supported on my server can I not do this /search/results?keywords=foo&author_id=1 without the url tag?
2. How would this query look without using the url tag? What's the purpose of the tag?
3. So to recap, the only way I can use url query strings for search is if my server support GET vars and I use not so pretty url query strings?
4. Can you tell me what advantage does Low Search have over Super Search for what I'm trying to do? I just want something that I can implement relatively easy.
Thanks!
Low 28 May 2013 16:15
1. Yes, You can.
2. The purpose of the tag is to generate direct search URLs, regardless of whether you're encoding the query in the URI or not. If you're encoding the query, the URL tag will create a URL like domain.com/search/results/eyJrZXl3b3JkcyI6ImhlbGxvIHdvcmxkIn0 -- which makes it hard to hardcode.
3. Your server will support GET vars, but it depends on your EE setup. Most likely it will work, but in some cases (when the uri_protocol config setting is set to QUERY_STRING), it does not. Again, mentioned here: http://gotolow.com/addons/low-search/...
4. Well, "easy" is relative, obviously. I can only point you to the comparison chart here: http://solsp.ac/e-searchcompare and the reviews at Devot:ee for both:
- http://devot-ee.com/add-ons/low-searc...
- http://devot-ee.com/add-ons/super-sea...