X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FSearchPage.java;h=4f307fe2d1d778cf374f33f5004eb55899a867f2;hp=41460b01d66c864ce72c639da21b93be5afc0cb3;hb=5723a2bb28376b0972a63bae2124846116cf6ca5;hpb=a47643aed43d118ca68044f95451bb5374cdb332 diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index 41460b0..4f307fe 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -40,12 +40,12 @@ import net.pterodactylus.util.cache.CacheItem; import net.pterodactylus.util.cache.DefaultCacheItem; import net.pterodactylus.util.cache.MemoryCache; import net.pterodactylus.util.cache.ValueRetriever; -import net.pterodactylus.util.collection.Mapper; -import net.pterodactylus.util.collection.Mappers; import net.pterodactylus.util.collection.Pagination; import net.pterodactylus.util.collection.TimedMap; -import net.pterodactylus.util.filter.Filter; -import net.pterodactylus.util.filter.Filters; +import net.pterodactylus.util.collection.filter.Filter; +import net.pterodactylus.util.collection.filter.Filters; +import net.pterodactylus.util.collection.mapper.Mapper; +import net.pterodactylus.util.collection.mapper.Mappers; import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.template.Template; @@ -168,7 +168,7 @@ public class SearchPage extends SoneTemplatePage { * The string generator for the objects * @return The hits for the given phrases */ - private Set> getHits(Collection objects, List phrases, StringGenerator stringGenerator) { + private static Set> getHits(Collection objects, List phrases, StringGenerator stringGenerator) { Set> hits = new HashSet>(); for (T object : objects) { String objectString = stringGenerator.generateString(object); @@ -189,7 +189,7 @@ public class SearchPage extends SoneTemplatePage { * The query to parse * @return The parsed phrases */ - private List parseSearchPhrases(String query) { + private static List parseSearchPhrases(String query) { List parsedPhrases = null; try { parsedPhrases = StringEscaper.parseLine(query); @@ -229,8 +229,8 @@ public class SearchPage extends SoneTemplatePage { * The expression to search * @return The score of the expression */ - private double calculateScore(List phrases, String expression) { - logger.log(Level.FINEST, "Calculating Score for “%s”…", expression); + private static double calculateScore(List phrases, String expression) { + logger.log(Level.FINEST, String.format("Calculating Score for “%s”…", expression)); double optionalHits = 0; double requiredHits = 0; int forbiddenHits = 0; @@ -250,10 +250,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); + logger.log(Level.FINEST, String.format("Got hit at position %d.", position)); ++matches; } - logger.log(Level.FINEST, "Score: %f", score); + logger.log(Level.FINEST, String.format("Score: %f", score)); if (matches == 0) { continue; }