projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'next' into new-database-38
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
SearchPage.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/SearchPage.java
b/src/main/java/net/pterodactylus/sone/web/SearchPage.java
index
54b6f49
..
691453d
100644
(file)
--- 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 - SearchPage.java - Copyright © 2010 David Roden
+ * Sone - SearchPage.java - Copyright © 2010
–2012
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
*
* 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
@@
-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.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.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;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.number.Numbers;
import net.pterodactylus.util.template.Template;
@@
-111,7
+111,7
@@
public class SearchPage extends SoneTemplatePage {
throw new RedirectException("index.html");
}
throw new RedirectException("index.html");
}
-
Set
<Sone> sones = webInterface.getCore().getSones();
+
Collection
<Sone> sones = webInterface.getCore().getSones();
Set<Hit<Sone>> soneHits = getHits(sones, phrases, SoneStringGenerator.COMPLETE_GENERATOR);
Set<Hit<Post>> postHits;
Set<Hit<Sone>> soneHits = getHits(sones, phrases, SoneStringGenerator.COMPLETE_GENERATOR);
Set<Hit<Post>> postHits;
@@
-168,7
+168,7
@@
public class SearchPage extends SoneTemplatePage {
* The string generator for the objects
* @return The hits for the given phrases
*/
* The string generator for the objects
* @return The hits for the given phrases
*/
- private <T> Set<Hit<T>> getHits(Collection<T> objects, List<Phrase> phrases, StringGenerator<T> stringGenerator) {
+ private
static
<T> Set<Hit<T>> getHits(Collection<T> objects, List<Phrase> phrases, StringGenerator<T> stringGenerator) {
Set<Hit<T>> hits = new HashSet<Hit<T>>();
for (T object : objects) {
String objectString = stringGenerator.generateString(object);
Set<Hit<T>> hits = new HashSet<Hit<T>>();
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
*/
* The query to parse
* @return The parsed phrases
*/
- private List<Phrase> parseSearchPhrases(String query) {
+ private
static
List<Phrase> parseSearchPhrases(String query) {
List<String> parsedPhrases = null;
try {
parsedPhrases = StringEscaper.parseLine(query);
List<String> parsedPhrases = null;
try {
parsedPhrases = StringEscaper.parseLine(query);
@@
-229,7
+229,7
@@
public class SearchPage extends SoneTemplatePage {
* The expression to search
* @return The score of the expression
*/
* The expression to search
* @return The score of the expression
*/
- private double calculateScore(List<Phrase> phrases, String expression) {
+ private
static
double calculateScore(List<Phrase> phrases, String expression) {
logger.log(Level.FINEST, String.format("Calculating Score for “%s”…", expression));
double optionalHits = 0;
double requiredHits = 0;
logger.log(Level.FINEST, String.format("Calculating Score for “%s”…", expression));
double optionalHits = 0;
double requiredHits = 0;