Range Filter Issue
I am having some problems getting the range filter to work properly in my search form however I'm not able to search the Get Satisfaction site because there's an entry that is breaking the search results (https://getsatisfaction.com/low/topic...).
Can you delete or modify that entry so I can search for "range" within your support site and see all of the results?
Thank you,
Nick
Replies
Low 9 Dec 2013 14:50
Looks like GetSat won't let me edit someone else's post (just the subject).
But if you describe your issue, I'm happy to help you out.
Nick Bedard 9 Dec 2013 20:05
The only way I can get the range search criteria to work is if I manually set $clean to true within EE_Input.php. This allows for the semicolon to display in the URL and does allow the filtering to work properly.
That is only if I manually enter something like 1000;10000 to the URL. If I submit the form with that same thing set as the value of my range field it gets removed from the URL when posted.
If I don't manually set $clean to TRUE and try to visit a search with the range criteria entered I get the error "Invalid GET Data".
Here is a URL you can view which should filter the results to three results (this is all test data at this point).
http://dev2.giggybook.com/browse?loos...
If you go to http://dev2.giggybook.com/browse/?col... you can attempt a regular search using the range field on the left which I just have hard coded at this point into a regular text input field.
Thank you very much for the prompt reply. Much appreciated!
Nick
Low 9 Dec 2013 20:16
Kind of was waiting for this sort of issue, to be honest. Setting Encode Query to Yes will solve the issue, but the best solution is to change the character that splits the from and to values.
To do that, open up /low_search/filters/lsf.ranges.php and look up line #64. That reads:
Change both instances of ';' to something like '::' (a double colon).
Nick Bedard 9 Dec 2013 20:29
Man you're quick! :)
I love the suggestion, that is exactly what we were thinking would be nice to be able to do, change the separator.
If you look at http://dev2.giggybook.com/browse?loos... you'll see that it is obviously allowing the new separator in the URL but the filtering itself doesn't appear to be working.
Low 9 Dec 2013 20:47
Couple of things to check here. The "band_preferred_rate" field should be a *numeric* field. So the "Field Content" setting should be Number, Integer or Decimal.
If that is indeed the case, you can check the query the Range filter generates. Enable the output profiler and look up the query that has the amounts in it. What does that tell you?
You can also enable the template debugger and check the lines that mention Low Search to see what's happening.
Nick Bedard 9 Dec 2013 21:08
The field is set to number so I don't think that's the issue.
When I turn on profiler I do see the initial get request:
$_GET['loose_ends'] both
$_GET['collection'] 1
$_GET['range:band_preferred_rate'] 0::1000
However, I don't see anything in the query list referencing band_preferred_rate which is the field it should be searching for the range in.
Low 9 Dec 2013 21:09
I'll need to take a look myself. Please send SuperAdmin login credentials to hi at gotolow dot com if you can.
Nick Bedard 9 Dec 2013 21:51
On their way. Thanks!!
Low 10 Dec 2013 07:06
I see you're running Low Search 2.4.2. Can you try upgrading to 3.0.2, then apply the same fix I mentioned above, and try again?
Nick Bedard 10 Dec 2013 12:14
I had updated last weekend but it caused errors on a channel form I was working on at the same time.
I will update shortly and give it a try but we might have other troubleshooting to do after the update. :)
Low 10 Dec 2013 12:32
Oh? Low Search should be completely unrelated to Channel Form. Let me know how it goes.
Nick Bedard 10 Dec 2013 14:18
The good news is, the range search works now! I replaced the ; with :: and everything seems to be filtering properly. Thank you!
Now as I thought it did create a strange secondary error...and it's kind of complicated to explain. Can I email you at your address instead of explaining it on here?
Low 10 Dec 2013 14:37
Sure, no problem.
Nick Bedard 11 Dec 2013 21:40
I forgot to ask before, are you changing the separator in the next version as well (from a semicolon) or is that something we'll have to do each for each update?
Low 11 Dec 2013 21:46
I gave it some thought, and reckoned using a vertical bar would be more consistent with other params. If you want to make sure you don't have to do any other updates, change the :: to a |, as that will be in the next version.
Nick Bedard 11 Dec 2013 21:54
Got it, updated. Works perfect.