0
votes

I have e-book's. It contains both text files and pictures. In my case any picture should file that stores NOT in the database but on the filesystem in the same Marklogic Server (using xdmp:save).

Q: Is there a way to upload a picture (or any binary asset) to the Marklogic Server filesystem using marklogic-xcc java api?

I've tried com.marklogic.xcc.Session#insertContent but it upload the content right to the database and I need to the filesystem.

Thank you for helping!

2

2 Answers

1
votes

Binaries larger than 1Mb are by default saved on disk rather than inside the MarkLogic database. It is kept within Forest data though, it can have document properties, and it is included in backups and such. I recommend sticking to that over serving binaries from plain file-system, particularly if you plan on going through MarkLogic to fetch them anyhow.

You can read more about that in the Application Developer's Guide, in the chapter Working With Binary Documents.

HTH!

0
votes

External Binaries serve the purpose you state. https://docs.marklogic.com/xdmp:external-binary They have a metadata only representation in the database, the actual 'file' you specify explicitly which can be a local file, an http or aws S3 file. Note that the consequence of this is that MarkLogic does not 'manage' in any way the actual file or content, only a reference to it. Its up to you to make sure the file is accessible on all servers, backed up, copied etc. The content of the file is not transactional, searchable, indexed. In fact it doesn't have to actually exist, or can represent a 'sparse' backend storage.

Recommend same as grtjn, use binaries instead of external binaries unless you absolutely have to. Binaries have all the transactional, backup, and distributed features of the database and all the features of a 'just a plain old binary file' -- with the exception that you must use ML API's to access it.