fix #2005 check if title is emtpy
This commit is contained in:
parent
f097a93a8e
commit
f341a4e2b2
1 changed files with 13 additions and 1 deletions
|
@ -226,7 +226,7 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
documentHelper.getDigest(responseData, bodyBase, dataMap, fessConfig.getCrawlerDocumentFileMaxDigestLengthAsInteger()));
|
||||
// title
|
||||
final String fileName = getFileName(url, urlEncoding);
|
||||
if (!dataMap.containsKey(fessConfig.getIndexFieldTitle())) {
|
||||
if (!hasTitle(dataMap)) {
|
||||
if (url.endsWith("/")) {
|
||||
if (StringUtil.isNotBlank(content)) {
|
||||
putResultDataBody(
|
||||
|
@ -329,6 +329,18 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
return dataMap;
|
||||
}
|
||||
|
||||
protected boolean hasTitle(final Map<String, Object> dataMap) {
|
||||
final Object titleObj = dataMap.get(fessConfig.getIndexFieldTitle());
|
||||
if (titleObj != null) {
|
||||
if (titleObj instanceof String[]) {
|
||||
return stream((String[]) titleObj).get(stream -> stream.anyMatch(StringUtil::isNotBlank));
|
||||
} else {
|
||||
return StringUtil.isNotBlank(titleObj.toString());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Map<String, String> createExtractParams(final ResponseData responseData, final CrawlingConfig crawlingConfig) {
|
||||
final Map<String, String> params = new HashMap<>(crawlingConfig.getConfigParameterMap(ConfigName.CONFIG));
|
||||
params.put(TikaMetadataKeys.RESOURCE_NAME_KEY, getResourceName(responseData));
|
||||
|
|
Loading…
Add table
Reference in a new issue