fix #1093 apply duplicate host replacement
This commit is contained in:
parent
51073c7422
commit
fb3cb33fee
2 changed files with 18 additions and 0 deletions
|
@ -43,6 +43,7 @@ import org.codelibs.fess.exception.ContainerNotAvailableException;
|
|||
import org.codelibs.fess.exception.ContentNotFoundException;
|
||||
import org.codelibs.fess.helper.CrawlingConfigHelper;
|
||||
import org.codelibs.fess.helper.CrawlingInfoHelper;
|
||||
import org.codelibs.fess.helper.DuplicateHostHelper;
|
||||
import org.codelibs.fess.helper.IndexingHelper;
|
||||
import org.codelibs.fess.helper.SambaHelper;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
|
@ -263,4 +264,13 @@ public class FessCrawlerThread extends CrawlerThread {
|
|||
url));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void storeChildUrl(final String childUrl, final String parentUrl, final String metaData, final int depth) {
|
||||
if (StringUtil.isNotBlank(childUrl)) {
|
||||
final DuplicateHostHelper duplicateHostHelper = ComponentUtil.getDuplicateHostHelper();
|
||||
final String url = duplicateHostHelper.convert(childUrl);
|
||||
super.storeChildUrl(url, parentUrl, metaData, depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ public class DuplicateHostHelperTest extends UnitFessTestCase {
|
|||
bar.setRegularName("www.bar.com");
|
||||
bar.setDuplicateHostName("mail.bar.com");
|
||||
duplicateHostHelper.duplicateHostList.add(bar);
|
||||
DuplicateHost hoge = new DuplicateHost();
|
||||
hoge.setRegularName("www.foo.com");
|
||||
hoge.setDuplicateHostName("www.foo.com:99");
|
||||
duplicateHostHelper.duplicateHostList.add(hoge);
|
||||
}
|
||||
|
||||
public void test_convert() {
|
||||
|
@ -59,6 +63,10 @@ public class DuplicateHostHelperTest extends UnitFessTestCase {
|
|||
result = "http://www.bar.com/";
|
||||
assertEquals(result, duplicateHostHelper.convert(url));
|
||||
|
||||
url = "http://www.foo.com:99/";
|
||||
result = "http://www.foo.com/";
|
||||
assertEquals(result, duplicateHostHelper.convert(url));
|
||||
|
||||
}
|
||||
|
||||
public void test_convert_skip() {
|
||||
|
|
Loading…
Add table
Reference in a new issue