Skip to content

Commit

Permalink
- fixes for host navigation
Browse files Browse the repository at this point in the history
- fixes for filetype navigation
- removed unused code
  • Loading branch information
Orbiter committed Dec 15, 2012
1 parent cb5cbec commit 9319b90
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 55 deletions.
3 changes: 0 additions & 3 deletions htroot/yacy/search.html
@@ -1,8 +1,5 @@
version=#[version]#
uptime=#[uptime]#
fwhop=#[fwhop]#
fwsrc=#[fwsrc]#
fwrec=#[fwrec]#
searchtime=#[searchtime]#
references=#[references]#
joincount=#[joincount]#
Expand Down
4 changes: 0 additions & 4 deletions htroot/yacy/search.java
Expand Up @@ -96,10 +96,6 @@ public static serverObjects respond(final RequestHeader header, final serverObje
prop.put("links", "");
prop.put("indexcount", "");
prop.put("indexabstract", "");
prop.put("fwhop", ""); // hops (depth) of forwards that had been performed to construct this result
prop.put("fwsrc", ""); // peers that helped to construct this result
prop.put("fwrec", ""); // peers that would have helped to construct this result (recommendations)


if (post == null || env == null) return prop;
if (!Protocol.authentifyRequest(post, env)) return prop;
Expand Down
4 changes: 2 additions & 2 deletions htroot/yacysearch.java
Expand Up @@ -445,9 +445,9 @@ public static serverObjects respond(
}
if ( !ft.isEmpty() ) {
if ( urlmask == null ) {
urlmask = ".*\\." + ft;
urlmask = ".*\\." + ft + "(\\?.*)?";
} else {
urlmask = urlmask + ".*\\." + ft;
urlmask = urlmask + ".*\\." + ft + "(\\?.*)?";
}
}
modifier.append("filetype:").append(ft).append(' ');
Expand Down
8 changes: 0 additions & 8 deletions source/net/yacy/peers/Protocol.java
Expand Up @@ -878,11 +878,6 @@ public static void remoteSearchProcess(
}

private static class SearchResult {
public String version; // version : application version of responder
public String uptime; // uptime : uptime in seconds of responder
public String fwhop; // hops (depth) of forwards that had been performed to construct this result
public String fwsrc; // peers that helped to construct this result
public String fwrec; // peers that would have helped to construct this result (recommendations)
public int urlcount; // number of returned LURL's for this search
public int joincount; //
public Map<byte[], Integer> indexcount; //
Expand Down Expand Up @@ -991,9 +986,6 @@ public SearchResult(
} catch ( final NumberFormatException e ) {
throw new IOException("wrong output format for count: " + e.getMessage());
}
this.fwhop = resultMap.get("fwhop");
this.fwsrc = resultMap.get("fwsrc");
this.fwrec = resultMap.get("fwrec");
// scan the result map for entries with special prefix
this.indexcount = new TreeMap<byte[], Integer>(Base64Order.enhancedCoder);
this.indexabstract = new TreeMap<byte[], String>(Base64Order.enhancedCoder);
Expand Down
41 changes: 3 additions & 38 deletions source/net/yacy/search/query/RankingProcess.java
Expand Up @@ -52,7 +52,6 @@
import net.yacy.cora.util.SpaceExceededException;
import net.yacy.document.Condenser;
import net.yacy.document.LibraryProvider;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.data.word.Word;
import net.yacy.kelondro.data.word.WordReference;
Expand Down Expand Up @@ -90,8 +89,6 @@ public final class RankingProcess extends Thread {
protected final ReferenceOrder order;
protected final HandleSet urlhashes; // map for double-check; String/Long relation, addresses ranking number (backreference for deletion)
protected final ScoreMap<String> hostNavigator = new ConcurrentScoreMap<String>(); // a counter for the appearance of host names
protected final ScoreMap<String> hostHashNavigator; // a counter for the appearance of the host hash (this can be filled during classic remote search)
protected final Map<String, byte[]> hostHashResolver; // a mapping from a host hash (6 bytes) to the full url hash of one of these urls that have the host hash
protected final Map<String, String> taggingPredicates; // a map from tagging vocabulary names to tagging predicate uris
protected final Map<String, ScoreMap<String>> vocabularyNavigator; // counters for Vocabularies; key is metatag.getVocabularyName()
private boolean remote;
Expand All @@ -118,8 +115,6 @@ protected RankingProcess(final QueryParams query, boolean remote) {
this.receivedRemoteReferences = new AtomicInteger(0);
this.order = new ReferenceOrder(this.query.ranking, UTF8.getBytes(this.query.targetlang));
this.urlhashes = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 100);
this.hostHashNavigator = new ConcurrentScoreMap<String>();
this.hostHashResolver = new ConcurrentHashMap<String, byte[]>();
this.vocabularyNavigator = new ConcurrentHashMap<String, ScoreMap<String>>();
this.taggingPredicates = new HashMap<String, String>();
for (Tagging t: LibraryProvider.autotagging.getVocabularies()) {
Expand Down Expand Up @@ -341,8 +336,8 @@ public void add(
}

// collect host navigation information (even if we have only one; this is to provide a switch-off button)
this.hostHashNavigator.inc(hosthash);
this.hostHashResolver.put(hosthash, iEntry.urlhash());
//this.hostHashNavigator.inc(hosthash);
//this.hostHashResolver.put(hosthash, iEntry.urlhash());

// check vocabulary constraint
String subject = YaCyMetadata.hashURI(iEntry.urlhash());
Expand Down Expand Up @@ -409,37 +404,7 @@ protected Map<byte[], ReferenceContainer<WordReference>> searchContainerMap() {
}

public ScoreMap<String> getHostNavigator() {
final ScoreMap<String> result = new ConcurrentScoreMap<String>();

final Iterator<String> domhashs = this.hostHashNavigator.keys(false);
DigestURI url;
byte[] urlhash;
String hosthash, hostname;
if ( this.hostHashResolver != null ) {
while ( domhashs.hasNext() && result.sizeSmaller(30) ) {
hosthash = domhashs.next();
if ( hosthash == null ) {
continue;
}
urlhash = this.hostHashResolver.get(hosthash);
url = urlhash == null ? null : this.query.getSegment().fulltext().getURL(urlhash);
hostname = url == null ? null : url.getHost();
if ( hostname != null ) {
result.set(hostname, this.hostHashNavigator.get(hosthash));
}
}
}

// add only navigation hosts which have more than one entry
Iterator<String> i = this.hostNavigator.keys(false);
while (i.hasNext()) {
String h = i.next();
int c = this.hostNavigator.get(h);
if (c <= 0) break;
result.inc(h, c);
}

return result;
return this.hostNavigator;
}

public Map<String,ScoreMap<String>> getVocabularyNavigators() {
Expand Down

0 comments on commit 9319b90

Please sign in to comment.