Storing large amounts of text in master data

I'm trying to figure out what would be the best way to store large amounts of text (over 255 characters) in Cocoa. Being a big fan of Core Data, I would suggest that this is an effective way to do this. However, I feel that the "string" is the wrong data type for this type of thing. Anyone have any info on this? I do not see options for BLOB in Core Data p>

+4
source share
3 answers

Well, you cannot compress text very well or store it as a binary file that needs to be translated, otherwise you will refuse SQLite query speed (because all records with text storage are binary-encoded) must be read into the memory translated / unpacked, then search). Otherwise, you will have to mirror (and maintain) the textual representation in your master data warehouse along with more fully functional material.

How about a hybrid solution? Core Data stores everything except the actual text; The text itself is archived in a file system with one file per write-in-Core-Data. Each file has a name for its unique identifier in the master data store. Thus, a search could do two things (in the background, of course): search the master data store for things like names, dates, etc .; search for files (possibly even using Spotlight) to search for content. If the search for the file matches, its file name is used to search for the corresponding entry in Core Data for display in the user interface of the application.

This allows you to use internal search criteria for a specific application and Spotlight software asynchronous search. This is a bit more work provided, but if you are talking about a large text, I cannot think of a better way.

+5
source

The BLOB data type is called β€œBinary Data” in Core Data. As Middapark noted, the Master Data Programming Guide provides some guidelines for working with binary data in Core Data. Depending on your requirements, an alternative to using BLOB would be to simply store links to files on disk.

+2
source

I would recommend reading the Apple Master Data Programming Guide (in particular, the Key Performance Indicators section). This specifically refers to BLOBs (see the section called β€œBig Data Objects (BLOBs)”) and gives some, though vague, recommendations.

0
source

Source: https://habr.com/ru/post/1335866/


All Articles