首页 \ 问答 \ 在MongoDB中存储扫描的(pdf,tiff,jpeg)文件。(storing a scanned (pdf,tiff,jpeg) file in MongoDB .)

在MongoDB中存储扫描的(pdf,tiff,jpeg)文件。(storing a scanned (pdf,tiff,jpeg) file in MongoDB .)

我必须在mongodb中存储tiff(标记图像文件格式)或pdf扫描文件,该文件应该是文本搜索功能。 就像我们想要“在文本的基础上”搜索它应该能够搜索。

我将使用.net mvc或java与mongodb。

那么如何存储这个pdf文件,然后可以从数据库中检索。

任何建议将不胜感激。

谢谢


I have to store a tiff(tag image file format) or pdf scanned file in mongodb that should be Text search able . like if we want to search "on base of text" it should be able to search .

I am going to use .net mvc or java with mongodb .

so how can i store this pdf file and then can retrieve from database .

any suggestion will be appreciated .

thanks


原文:https://stackoverflow.com/questions/41084036
更新时间:2022-09-19 07:09

最满意答案

感谢灰色! 正如Gray所说的,解决方案是使用callBatchTasks方法:

public void updateListOfObjects (final List <Object> list) {
    try {
        getHelper().getObjectDao().callBatchTasks(new Callable<Object> (){
        @Override
        public Object call() throws Exception {
            for (Object obj : list){
                getHelper().getObjectDao().createOrUpdate(obj);
                }
            return null;
        }

    });
} catch (Exception e) {
    Log.d(TAG, "updateListOfObjects. Exception " + e.toString());
}
}

以这种方式,我的对象(两种类型的对象,第一种 - 约100项,第二种 - 约150项)在1.7秒内存储。

查看ORMLite文档


Thanks to Gray! Solution is, as mentioned Gray, using callBatchTasks method:

public void updateListOfObjects (final List <Object> list) {
    try {
        getHelper().getObjectDao().callBatchTasks(new Callable<Object> (){
        @Override
        public Object call() throws Exception {
            for (Object obj : list){
                getHelper().getObjectDao().createOrUpdate(obj);
                }
            return null;
        }

    });
} catch (Exception e) {
    Log.d(TAG, "updateListOfObjects. Exception " + e.toString());
}
}

Using this way, my objects (two types of objects, 1st type - about 100 items, 2nd type - about 150 items) store in 1.7 sec.

See the ORMLite documentation.

相关问答

更多