在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
最满意答案
感谢灰色! 正如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.
相关问答
更多-
带有ORMLite的Android游标在CursorAdapter中使用(Android Cursor with ORMLite to use in CursorAdapter)[2022-02-18]
ORMLite现在支持CloseableIterator类的 next() , previous() , moveRelative(offset) ,...方法。 这应该允许您Cursor移动底层的Cursor对象。 它还支持以下DAO游标方法: dao.mapSelectStarRow(databaseResults)从查询中返回数据库结果中的最新行以select * 。 有了这个,你可以改变光标的位置(例如),然后获取当前对象。 dao.getSelectStarRowMapper()提供一个映射器,您 ... -
ORMLite方言(ORMLite Dialects)[2022-03-31]
我发现连接工厂中正在使用自动分配连接来设置setGlobalConnection变量: public void RegisterConnection(string connectionKey, string connectionString, IOrmLiteDialectProvider dialectProvider, bool autoDisposeConnection = true) { NamedConnections[connectionKey] = new OrmLiteCon ... -
将ORMLite与片段一起使用(Using ORMLite with Fragments)[2022-03-18]
是的,这完全有可能。 请参阅此处的说明。 基本上,你所做的就是创建一个新班,就像你所建议的那样。 您可以将Fragment替换为您想要扩展的任何其他类型。 例如,我也有扩展ListFragment public class OrmLiteFragment extends Fragment { private DatabaseHelper databaseHelper = null; protected DatabaseHelper getHelper() { if (da ... -
实际上我没有意识到我需要检查Config.txt中的列名,它就是两个相似的列名,这导致了这个重复问题。 Actually i didn't realize that I needed to check the Config.txt for Column names too, there it was, two similar column names which caused this duplication problem.
-
查看代码,您实际上没有创建表,您需要将createTableIfNotExist添加到OrmLiteSqliteOpenHelper类的onCreate方法中。 TableUtils.createTableIfNotExists(ConnectionSource connectionSource, Class
dataClass); Looking at your code, you haven't actually created the table, you'll need to add cre ... -
感谢灰色! 正如Gray所说的,解决方案是使用callBatchTasks方法: public void updateListOfObjects (final List
-
懒惰的集合已经过很好的测试,并且正在被许多其他人使用,所以尽管可能存在漏洞,但更有可能是你被懒惰的集合类欺骗了。 当从DAO检索每个UserShow对象时, episodes将不为null,而是将设置为LazyForeignCollection的实例。 但是,不会进行任何其他查询,并且集合中不会包含Episode数据。 如果您随后调用集合中的某个方法,例如userShow.getEpisodes().iterator() ,那么此时会进行单独的查询,以允许您遍历该节目的剧集。 这就是懒惰集合的工作原理。 如 ...
-
我不确定你是使用ORMLite还是GreenDAO。 它们是分开的东西。 我认为您遇到问题,因为您正在使用bookmark ID删除: getHelper().getBookmarkDao().deleteById(bookmark.getId()); 但是然后列出isbn的书签: List
lst = listBookmarks(bookmark.getIsbn()); 如果它们不是同一个领域那么就是你的问题。 I'm not sure if you are using ORMLi ... -
当然不是,你可以定义许多类来坚持和做: (new DatabaseHelper(getApplicationContext())).getDao(TheClassYouWant.class) 得到任何dao。 不要忘记在onCreate,onUpgrade中定义每个表: TableUtils.createTable(connectionSource, SimpleData.class); TableUtils.createTable(connectionSource, OtherSimpleData.cl ...
-
问题是它需要花费太多时间,比如接近1500次接触需要花费将近70秒的时间 @CarloB在dao. callBatchTasks(...)内部进行质量创造方面有正确的答案dao. callBatchTasks(...) dao. callBatchTasks(...)方法。 这是关于该主题的文档: http://ormlite.com/docs/batch 为了使事情变得更快,您还可以在另一个List记录并记录所有mFormatedNumber ,然后使用IN查询查询它们。 使用原始查询来获取已存在于数据库 ...