parisholley / wordpress-fantastic-elasticsearch

Improve wordpress search performance/accuracy and enable faceted search by leveraging an ElasticSearch server.
MIT License
162 stars 64 forks source link

What's expected behavior for a blank search? #48

Closed deltamualpha closed 11 years ago

deltamualpha commented 11 years ago

from my tests, it appears that searching for "" or " " falls through to the default Wordpress search. Is that expected?

parisholley commented 11 years ago

yes/no. expected in that if the ElasticSearch server throws an exception, it will fall back to wordpress. not expected in that it would not work with elasticsearch. Looking at php server log I can see the exception being logged when using that search term. Question is whether we should try to validate input data before calling ES.

deltamualpha commented 11 years ago

Well, Wordpress doesn't really support displaying a blank search, if http://wordpress.org/support/topic/blank-search-sends-you-to-the-homepage and http://accessites.org/site/2009/01/wordpress-empty-searches/ is anything to go by, so on one level what the plugin does is odd, because wordpress thinks a blank search "shouldn't happen".

(Whether that's a good or bad thing is left as an exercise for the reader.)

parisholley commented 11 years ago

how is " or " a blank search? do you mean if we parsed the query and determine there were no terms we'd treat it like a "no search"? or that currently if you do "/?s=" it doesn't redirect you to homepage?

deltamualpha commented 11 years ago

Ah, ok, two separate things. My theme has a special filter set up that automatically converts a null search -- "/?s=" to "/?s=+", which prevents the home-page redirect and instead returns all pages in reverse chronological order. But that would also happen even if fantastic-elasticsearch wasn't installed.

I don't know if this plugin should make a choice about what's a "valid" search; perhaps it's better left to the theme creator.

parisholley commented 11 years ago

agree. so is there something to fix/add here or can we close issue?

deltamualpha commented 11 years ago

I think we can close.