ParseException and how to ensure at least 3 characters
Hi everyone
I have a search on my site but if I just put a " in the search box it throws a ParseException. Any ideas how I stop that?
Also, if I put a single character like 'a' it searches and brings back the entire site. Can I restrict the search length?
Search can be seen here:
http://www.ceredigion.gov.uk/resident/
I suspect you have an old version of the ezSearch macro script ? (you error line isn't in that place on the latest script)
I have just tested your quries on a site i have running ezSearch and they work. there are two functions.
CleanseSearchTerm() and Tokenize() which will remove the small letter queries (so take the 'a' out)
also, there in the current version there is a check that will not run the search if there are no terms so if you search for 'a' then a blank search shouldn't run.
I would suggest you grab a new version of ezSearch - you (might) be able to update your script with the one from the repo (assuming none of the macro paramters have changed.
I got the files from the project page version 1.2.
Is that the latest copy of the code in the link you sent? I pasted that over my version but still get the error. Also, my error is on line 113 and that is the same line in the link you sent.
Sorry pasted my version over the top of my file. But now have done it correctly and pasted your version over the top but get the same error but on line 135
i would comment most of the remaining code (from line 135 to around 196) out and just write the query string to the page to see what's going on. (so just @query.ToString()
but it is odd, I will check that the site i have this odd hasn't got some random customisation in it. but i don't think it has.
ParseException and how to ensure at least 3 characters
Hi everyone
I have a search on my site but if I just put a " in the search box it throws a ParseException. Any ideas how I stop that?
Also, if I put a single character like 'a' it searches and brings back the entire site. Can I restrict the search length? Search can be seen here: http://www.ceredigion.gov.uk/resident/
Here is the ParseException
Thanks David
Hi
I suspect you have an old version of the ezSearch macro script ? (you error line isn't in that place on the latest script)
I have just tested your quries on a site i have running ezSearch and they work. there are two functions.
CleanseSearchTerm()
andTokenize()
which will remove the small letter queries (so take the 'a' out)also, there in the current version there is a check that will not run the search if there are no terms so if you search for 'a' then a blank search shouldn't run.
I would suggest you grab a new version of ezSearch - you (might) be able to update your script with the one from the repo (assuming none of the macro paramters have changed.
https://github.com/umco/umbraco-ezsearch/blob/master/Src/Our.Umbraco.ezSearch/Web/UI/Views/MacroPartials/ezSearch.cshtml
once you have the new script - you can look at changing the line
to also check length, so search wouldn't run for less than 3 characters.
Hi Kevin
I got the files from the project page version 1.2.
Is that the latest copy of the code in the link you sent? I pasted that over my version but still get the error. Also, my error is on line 113 and that is the same line in the link you sent.
Not sure I understand
David
Sorry pasted my version over the top of my file. But now have done it correctly and pasted your version over the top but get the same error but on line 135
Hi
that is odd, i think you might need to do some script debugging :(
when you search for a single quote " what should happen is that it is wrapped by this line
So it becomes
"""
which looks odd but is fine.i would comment most of the remaining code (from line 135 to around 196) out and just write the query string to the page to see what's going on. (so just
@query.ToString()
but it is odd, I will check that the site i have this odd hasn't got some random customisation in it. but i don't think it has.
Hi,
You'll need to test this but I had some issues with dodgy chars and short searches and this sort of thing and suggested some changes.
They are sat in a pull request - might be worth a look.
https://github.com/cheeseytoastie/ezSearch/blob/patch-2/Src/Our.Umbraco.ezSearch/Web/UI/Views/MacroPartials/ezSearch.cshtml
HTH
Steve
is working on a reply...