Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
*/
package fr.pilato.elasticsearch.crawler.fs.beans;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import fr.pilato.elasticsearch.crawler.fs.framework.FsCrawlerIllegalConfigurationException;
import fr.pilato.elasticsearch.crawler.fs.framework.JsonUtil;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Iterator;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.node.ObjectNode;

public class DocUtils {

Expand Down Expand Up @@ -123,10 +123,8 @@ public static Doc getMergedDoc(Doc doc, InputStream tags, ObjectMapper mapper)
* @return the merged nodes
*/
private static JsonNode merge(JsonNode mainNode, JsonNode updateNode) {
Iterator<String> fieldNames = updateNode.fieldNames();

while (fieldNames.hasNext()) {
String fieldName = fieldNames.next();
for (Map.Entry<String, JsonNode> entry : updateNode.properties()) {
String fieldName = entry.getKey();
JsonNode jsonNode = mainNode.get(fieldName);

if (jsonNode != null) {
Expand All @@ -152,7 +150,7 @@ private static JsonNode merge(JsonNode mainNode, JsonNode updateNode) {
public static String prettyPrint(Doc doc) {
try {
return JsonUtil.prettyMapper.writeValueAsString(doc);
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
logger.warn("Can not pretty print the document as json", e);
return null;
}
Expand Down
4 changes: 0 additions & 4 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
Expand Down
32 changes: 16 additions & 16 deletions docs/source/admin/fs/elasticsearch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -730,33 +730,33 @@ Here is a typical JSON document generated by the crawler:
{
"content":"This is a sample text available in page 1\n\nThis second part of the text is in Page 2\n\n",
"content_semantic":"This is a sample text available in page 1\n\nThis second part of the text is in Page 2\n\n",
"file":{
"content_type":"application/vnd.oasis.opendocument.text",
"created":"2018-07-30T11:35:08.000+0000",
"extension":"odt",
"filename":"test.odt",
"filesize":6236,
"indexing_date":"2018-07-30T11:35:19.781+0000",
"last_accessed":"2018-07-30T11:35:08.000+0000",
"last_modified":"2018-07-30T11:35:08.000+0000",
"url":"file:///tmp/test.odt"
},
"meta":{
"author":"David Pilato",
"title":"Test Tika title",
"created":"2016-07-07T16:37:00.000+0000",
"date":"2016-07-07T16:37:00.000+0000",
"description":"Comments",
"keywords":[
"keyword1",
" keyword2"
],
"language":"en",
"description":"Comments",
"created":"2016-07-07T16:37:00.000+0000"
},
"file":{
"extension":"odt",
"content_type":"application/vnd.oasis.opendocument.text",
"created":"2018-07-30T11:35:08.000+0000",
"last_modified":"2018-07-30T11:35:08.000+0000",
"last_accessed":"2018-07-30T11:35:08.000+0000",
"indexing_date":"2018-07-30T11:35:19.781+0000",
"filesize":6236,
"filename":"test.odt",
"url":"file:///tmp/test.odt"
"title":"Test Tika title"
},
"path":{
"real":"/tmp/test.odt",
"root":"7537e4fb47e553f110a1ec312c2537c0",
"virtual":"/test.odt",
"real":"/tmp/test.odt"
"virtual":"/test.odt"
}
}

Expand Down
Loading
Loading