Skip to content

Commit

Permalink
merging #18104 to 5.2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
wezell authored and dsilvam committed Mar 6, 2020
1 parent 01dfd9e commit 86356dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.liferay.portal.model.User;
import com.liferay.util.StringPool;
import io.vavr.control.Try;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
Expand Down Expand Up @@ -553,7 +554,15 @@ protected void loadFields(final Contentlet contentlet, final Map<String, Object>
.append(field.getVelocityVarName());
keyName = keyNameBuilder.toString();
keyNameText = keyNameBuilder.append(TEXT).toString();
if (field.getFieldType().equals(Field.FieldType.BINARY.toString()) // todo: remove this since we are going to index the binary fields

if (field.getFieldType().equals(Field.FieldType.BINARY.toString()) && field.isIndexed()){
String fileName = Try.of(()-> contentlet.getBinary(field.getVelocityVarName()).getName()).getOrElse("_unk");
contentletMap.put(keyName, fileName);
contentletMap.put(keyNameText, fileName);
continue;
}

if (field.getFieldType().equals(Field.FieldType.BINARY.toString())
|| field.getFieldContentlet() != null && (field.getFieldContentlet().startsWith(ESMappingConstants.FIELD_TYPE_SYSTEM_FIELD)
&& !field.getFieldType().equals(Field.FieldType.TAG.toString()))) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public List<Field> requiredFields(){

fields.add(
ImmutableBinaryField.builder()
.name("Binary Asset")
.name("Asset")
.variable(ASSET_FIELD_VAR)
.sortOrder(fields.size())
.fixed(true)
Expand Down

0 comments on commit 86356dd

Please sign in to comment.