Coroico / AdvSearch

Dynamic content search add-on for MODx Revolution that supports results highlighting, faceted search and search in custom packages
21 stars 14 forks source link

wrong behaviour in ajax mode with livesearch #49

Open manicko opened 11 years ago

manicko commented 11 years ago

if starts to fill in the search form with text (in ajax mode with livesearch) wait till the first results appear then delete the text using backspace the search will show all site pages as a result

craigphiz commented 10 years ago

@manicko I'm seeing this behaviour too. Did you, or anyone discover a solution?

Update: Is this by design? Noticed on the simple test demo page (http://www.revo.wangba.fr/simple-test-ajax.html) leaving the search box empty and clicking 'Search' the results show all site pages. I'm seeing the same on my installation with &livesearch='0' and a null search term.

Attempted for a few hours to disable this behaviour in advsearch.class.php but my head is spinning now ;)

Any help greatly appreciated!

craigphiz commented 10 years ago

Latest: After hours of looking through the code, discovered this hack to stop the livesearch results showing all site pages if the search box is empty ( ie, the prior search term has been deleted )

In assets/components/advsearch/js/advsearch.min.js delete &&st.length!=0 in the if statement on line 54

Hoping this helps you too.

goldsky commented 10 years ago

do you mind to show me that line in here? https://github.com/Coroico/AdvSearch/blob/Development/assets/components/advsearch/js/advsearch.js

craigphiz commented 10 years ago

Looks like line 204:

if (as.si.length && (st.length !== 0) && as.ls && (st.length < as.mc)) {

suggest changing this to:

if (as.si.length && as.ls && (st.length < as.mc)) {

Have not tested. Maybe you can post back once you've tested? Good luck!