Revision: 2853 http://archive-access.svn.sourceforge.net/archive-access/?rev=2853&view=rev Author: bradtofel Date: 2009-10-28 00:18:16 +0000 (Wed, 28 Oct 2009) Log Message: ----------- FEATURE: optionally can add results that are filtered to an "annotater" which is really a QueryFilterGroup. Later the QueryFilterGroup can annotate the search results with "close matches" Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/HostMatchFilter.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/HostMatchFilter.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/HostMatchFilter.java 2009-10-28 00:16:36 UTC (rev 2852) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/HostMatchFilter.java 2009-10-28 00:18:16 UTC (rev 2853) @@ -25,6 +25,7 @@ package org.archive.wayback.resourceindex.filters; import org.archive.wayback.core.CaptureSearchResult; +import org.archive.wayback.resourceindex.filterfactory.QueryCaptureFilterGroup; import org.archive.wayback.util.ObjectFilter; /** @@ -37,10 +38,20 @@ public class HostMatchFilter implements ObjectFilter<CaptureSearchResult> { private String hostname = null; + private QueryCaptureFilterGroup annotationTarget = null; /** * @param hostname String of original host to match */ + public HostMatchFilter(final String hostname, + QueryCaptureFilterGroup annotationTarget) { + this.hostname = hostname; + this.annotationTarget = annotationTarget; + } + + /** + * @param hostname String of original host to match + */ public HostMatchFilter(final String hostname) { this.hostname = hostname; } @@ -50,6 +61,13 @@ */ public int filterObject(CaptureSearchResult r) { String origHost = r.getOriginalHost(); - return hostname.equals(origHost) ? FILTER_INCLUDE : FILTER_EXCLUDE; + if(hostname.equals(origHost)) { + return FILTER_INCLUDE; + } else { + if(annotationTarget != null) { + annotationTarget.addCloseMatch(origHost, r.getOriginalUrl()); + } + return FILTER_EXCLUDE; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |