X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FSearchPage.java;h=74bfd10db237d5ea06ee753f0aa390ef7608d3b2;hb=687f0d7fa8b9b070f8967192483c05546a4439f5;hp=903975dbd075996be17221c17e4732f571cf8d94;hpb=8759d9a5f7e33303810ba50ad97746983d5b7d38;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index 903975d..74bfd10 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -1,5 +1,5 @@ /* - * Sone - OptionsPage.java - Copyright © 2010 David Roden + * Sone - SearchPage.java - Copyright © 2010 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,8 @@ import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Profile; @@ -50,6 +52,9 @@ import net.pterodactylus.util.text.TextException; */ public class SearchPage extends SoneTemplatePage { + /** The logger. */ + private static final Logger logger = Logging.getLogger(SearchPage.class); + /** * Creates a new search page. * @@ -187,6 +192,7 @@ public class SearchPage extends SoneTemplatePage { * @return The score of the expression */ private double calculateScore(List phrases, String expression) { + logger.log(Level.FINEST, "Calculating Score for “%s”…", expression); double optionalHits = 0; double requiredHits = 0; int forbiddenHits = 0; @@ -206,8 +212,10 @@ public class SearchPage extends SoneTemplatePage { } score += Math.pow(1 - position / (double) expression.length(), 2); index = position + phraseString.length(); + logger.log(Level.FINEST, "Got hit at position %d.", position); ++matches; } + logger.log(Level.FINEST, "Score: %f", score); if (matches == 0) { continue; }