46 |
46 |
private static final String FIELD_TEXT_REGION_COORDS = "text_region" + SUFFIX_COORDS;
|
47 |
47 |
private static final String FIELD_DOC_CONTENT = "doc_content";
|
48 |
48 |
private static final String FIELD_IMG_CONTENT = "img_content";
|
49 |
|
private static final float IMG_OUTPUT_QUALITY = 0.1f;
|
|
49 |
private static final float IMG_OUTPUT_QUALITY = 0.5f;
|
50 |
50 |
private static final Logger LOG = LoggerFactory.getLogger(IndexController.class);
|
51 |
51 |
|
52 |
52 |
private static final int SEARCH_QUERY_ROWS = 100;
|
... | ... | |
478 |
478 |
solrQuery.set("q", FIELD_DOC_FILENAME + ":*");
|
479 |
479 |
solrQuery.setRows(500); // todo not a magic number!
|
480 |
480 |
SolrDocumentList docList = solrClientFiles.query(solrQuery).getResults();
|
481 |
|
return docList.stream().map(doc -> doc.getFieldValue(FIELD_DOC_FILENAME).toString()).collect(Collectors.toList());
|
|
481 |
return docList.stream().map(doc -> doc.getFieldValue(FIELD_DOC_FILENAME).toString().replaceAll(".xml", "")).collect(Collectors.toList());
|
|
482 |
}
|
|
483 |
|
|
484 |
public String listSingleFile(String documentName) throws IOException, SolrServerException {
|
|
485 |
LOG.trace("SolrService method listSingleFile called");
|
|
486 |
LOG.debug("Displaying single file in Solr");
|
|
487 |
SolrQuery solrQuery = new SolrQuery();
|
|
488 |
solrQuery.set("q", FIELD_DOC_FILENAME + ":*");
|
|
489 |
//solrQuery.set("q", FIELD_DOC_FILENAME + ":" + documentName + ".xml");
|
|
490 |
solrQuery.setRows(500); // todo not a magic number!
|
|
491 |
SolrDocumentList docList = solrClientFiles.query(solrQuery).getResults();
|
|
492 |
String ret = "";
|
|
493 |
|
|
494 |
for (SolrDocument solrDocument : docList){
|
|
495 |
if (solrDocument.getFieldValue(FIELD_DOC_FILENAME).toString().equals(documentName + ".xml")){
|
|
496 |
String imgFilename = (String) solrDocument.getFieldValue(FIELD_IMG_FILENAME);
|
|
497 |
byte[] imageBytes = getImageFromFilesCore(imgFilename);
|
|
498 |
|
|
499 |
BufferedImage img = ImageIO.read(new ByteArrayInputStream(Base64.getDecoder().decode(imageBytes)));
|
|
500 |
Image cropImg = new Image(img);
|
|
501 |
cropImg.setOutputQuality(IMG_OUTPUT_QUALITY);
|
|
502 |
|
|
503 |
imageBytes = cropImg.getByteArray();
|
|
504 |
imageBytes = Base64.getEncoder().encode(imageBytes);
|
|
505 |
ret = new String(imageBytes);
|
|
506 |
break;
|
|
507 |
}
|
|
508 |
}
|
|
509 |
if (ret.equals("")){
|
|
510 |
LOG.error("File was NOT found in Solr");
|
|
511 |
} else{
|
|
512 |
LOG.debug("File was found in Solr");
|
|
513 |
}
|
|
514 |
return ret;
|
482 |
515 |
}
|
483 |
516 |
|
484 |
517 |
}
|
Re #7915: Zobrazení celého dokumentu na BE
- vytvořeno posílání jednoho dokumentu na FE
- úprava posílání názvů dokumentů na FE: nyní bez koncovky