Redirect to index if no phrases have been found.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 12 Jul 2011 04:28:53 +0000 (06:28 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 12 Jul 2011 04:28:53 +0000 (06:28 +0200)
src/main/java/net/pterodactylus/sone/web/SearchPage.java

index 6f5e001..d50a254 100644 (file)
@@ -83,6 +83,9 @@ public class SearchPage extends SoneTemplatePage {
                }
 
                List<Phrase> phrases = parseSearchPhrases(query);
+               if (phrases.isEmpty()) {
+                       throw new RedirectException("index.html");
+               }
 
                Set<Sone> sones = webInterface.getCore().getSones();
                Set<Hit<Sone>> soneHits = getHits(sones, phrases, SoneStringGenerator.COMPLETE_GENERATOR);