Windows 10: Searching Private App Data in Windows 10

Discus and support Searching Private App Data in Windows 10 in Windows 10 News to solve the problem; Searching Private App Data in Windows 10 Up until this point I’ve walked through how you can use the indexer to search through public data on a... Discussion in 'Windows 10 News' started by Cluster Head, Apr 6, 2016.

  1. Searching Private App Data in Windows 10


    Searching Private App Data in Windows 10

    Walking through the properties we can see what each of them means:


    Property

    Meaning

    Values (For illustration purposes only, not complete)

    Notes

    inInvertedIndex Is the property contained in the inverted index and is it searchable True = Property is searchable
    False = Property cannot be searched with the indexer If the property isn’t in the inverted index, then searching against it isn’t going to work. Try to find another property instead.
    isColumn Is the property stored in the index for fast retrieval. Data stored in the inverted index cannot be recovered and returned in search results instead it must be written in a separate location in the database. True = Property can be retrieved from the indexer as a part of the query results
    False = The indexer is going to have to try to recover this data from the original item if it is requested as a part of search results Requesting query results to contain data not held in a column results in a >100x slowdown in query performance
    maxSize The number of bytes reserved in the index for a given property to be stored in Trying to store anything larger than max size isn’t supported.
    isColumnSparse
    columnIndexType These are used to describe how the indexer is going to set up the columns on disk These can be safely ignored assuming that you have isColumn = true.
    Type The datatype of the property. Datatype mismatches are going to result in the indexer ignoring that field String, FILETIME (DateTimeOffset in C#), UINT32, Custom Enumeration Make sure you are using the international ready values for shell enumerations using the # sign
    isInnate Indicates if the datatype can be set by the metadata in the file or comes from the system True = the property value will be derived from file system metadata
    False = the property can be set by information in the file Important to note that setting innate properties with the ContentIndexer sometimes will fail silently. Makes for exciting to find bugs, so try to avoid them.

    The other properties describe parts of the property system that we aren’t going to need for searching. And in the interest of not turning this into a rant about IShellItems they are ignored in the above chart.

    This means if we are going to use a property in a query, we’ll need to make sure it is a column and in the inverted index. As well, if you are planning on pushing data you’ll need to ensure that the data being pushed in matches the type the index is expecting.

    Indexed Folder

    The indexed folder was designed to be as simple to use as possible. The app only has to create a folder named “indexed” in its app data directory

    StorageFolder localFolder = ApplicationData.Current.LocalFolder; //Don’t internationalize the folder name StorageFolder indexedFolder = await localFolder.CreateFolderAsync(“indexed”);

    And that is it. Any file that you create in the indexed folder are going to be automatically indexed. All the fancy AQS queries that work in public libraries are now available to your app’s private data.

    Appcontent-ms Files

    There are a few rare cases where your app may have data that it wants to search, but doesn’t want to deal with the complexity of the ContentIndexer. For example if you have data that isn’t going to change over time, such as the settings on a PC. In this case the appcontent-ms files are a great way to provide rich local search with very little work in your app

    The documentation gives a very complete example of how to use these files, so I won’t rehash any of that information here. Instead, I’ll highlight a few important things that might be helpful when using the indexed folder.

    All the information from my previous post about reading the shell property system documentation holds. There are no restrictions about which properties that you can populate with an appcontent-ms file other than the data type restrictions from the shell schema. The indexer will very happily let you put email addresses in System.Music.AlbumTile, but if you try and store a string in System.Music.IsCompilation it will ignore the value and index the rest of the file.

    Indexer isn’t instant, there will be some time lag between the when you create the appcontent-ms files and when indexing completes. On an otherwise idle machine the delay should be only a few milliseconds, but that is going to be a lot slower than the very next line of code in your app. Give it some time before you start querying, and if you need to query right away use the IndexerOptions.UseIndexerWhenAvailable option. That way the system will make the smart choice about using the indexer vs. the slower option of just scanning the disk.

    All subfolders of the indexed folder will be indexed as well. The settings app has a neat setup where they will have a subfolder for each language installed on the machine. Makes their code for adding and removing languages really clean and easy to maintain.

    Content Indexer

    The ContentIndexer class and its related APIs were added to the system in Windows 8.1 as a new way for apps to push data into the indexer. They were created as a direct replacement for the protocol handler model that was previously used and have been used by a number of apps internally. The biggest customers by far are Edge, pushing in the user’s history, and Groove Music, pushing in the user’s cloud music collection.

    Both of these cases are highlight what these APIs are great for, data that can be recreated from another source but needs to be easy to search. The indexer is especially powerful in the case of Edge, since URLs often contain bunched together words in a number of languages combined with unusual punctuation. The indexer is able to separate out the words from the other text tokens and make the URLs easier to search.

    Using the APIs

    I’m not going to rehash the basic samples here, the basic code works great on Windows 10. Instead I’d like to walk through a few important things to note about using ContentIndexer APIs.

    Read the shell property system documentation

    Make sure you understand the previous section about reading the documentation for which properties can be used. The indexer doesn’t have any way of knowing if you want a property to be searchable (isInvertedIndex), retrievable from a query result (isColumn), or both.

    Check your data types

    Before storing data make sure that you have the right datatypes and that you aren’t going to be overflowing text fields. In C# it is really easy to end up with a massive string that isn’t going to fit into the particular field you’re using.

    Implementing IIndexableContent is a Good Thing

    Every successful app I’ve seen use the ContentIndexer has had a domain specific class that implements IIndexableContent. Not only does it make your data model easier but it isolates the nasty pattern of retrieve property  check for null  cast to correct data type  make sure that doesn’t fail  Sanity check resulting value to one location in your code.

    Check for indexer resets

    The indexer can be reset which will cause all the data in it to be lost. On a Windows upgrade (not just a patch, it has to be a significant diff) the indexer will detect that the shell schema has changed and will rebuild to match the new schema. An app simply needs to check the ContentIndexer.Revision property to see if there has been a rebuild. If there is a rebuild, all the previous data will be gone and the app has to re-push any data they’d like to be searchable.

    Unit test storage and retrieval until you’re sick of it

    This is for my own wellbeing as well as yours. A couple unit tests that hammer storing, searching, and retrieving a value go a long way to making sure your code works. It’s embarrassing the number of hours I’ve wasted debugging apps only to realize the property being used doesn’t support retrieval. It takes a minute to write the test and will save both of us a lot of hassle.

    And that’s it. Let me know if you have any more questions about the ContentIndexer, indexed folder or reading the shell properties in the comments below. I look forward to seeing how you use it in your apps.
    Source: https://blogs.msdn.microsoft.com/ada...in-windows-10/

    :)
     
    Cluster Head, Apr 6, 2016
    #1

  2. Clear You tube url history

    If you mean the search history in the YouTube app, you can clear this under Menu -> Help -> Clear Search History. There is also an option to Clear Private Data.
     
    thetao---01, Apr 6, 2016
    #2
  3. Windows 10 Sucks

    **** Windows 10. **** Microsoft. **** my private data
     
    70f7aced-3465-4157-8d8f-298c18c2430f, Apr 6, 2016
    #3
Thema:

Searching Private App Data in Windows 10

Loading...
  1. Searching Private App Data in Windows 10 - Similar Threads - Searching Private App

  2. Windows 10 private network

    in Windows 10 Network and Sharing
    Windows 10 private network: i have three computers. They all see each other on Windows Explorer. Computers A and B can access each other. Computers B and C can access each other. Computer A can access Computer C but C can't access computer A. This is the real problem because the printer is connected to...
  3. Windows 10 private network

    in Windows 10 Gaming
    Windows 10 private network: i have three computers. They all see each other on Windows Explorer. Computers A and B can access each other. Computers B and C can access each other. Computer A can access Computer C but C can't access computer A. This is the real problem because the printer is connected to...
  4. Windows 10 private network

    in Windows 10 Software and Apps
    Windows 10 private network: i have three computers. They all see each other on Windows Explorer. Computers A and B can access each other. Computers B and C can access each other. Computer A can access Computer C but C can't access computer A. This is the real problem because the printer is connected to...
  5. windows 10 search and apps

    in Cortana
    windows 10 search and apps: i have problem in windows 10 search box and microsoft store and some apps don't work if i tried to run the store or hp smart its freeze for seconds and crash the same problem with search and mail app and can't add my email to the device i have created new user all works fine...
  6. Photos app in Windows 10 and private photos

    in AntiVirus, Firewalls and System Security
    Photos app in Windows 10 and private photos: Hey guys, does anybody know how Photos app in win 10 treats pornographic images? What if I have private photos in my Pictures folder? Is that a threat to privacy?...
  7. Windows 10 App data files

    in Windows 10 Network and Sharing
    Windows 10 App data files: I have an Excel file that got saved in the Appdata/roaming space. Now it will not load formula data from other files that are on my C: drive. How can I restore the file to the C: drive? I have two computers on my home network, both running Windows 10 and on the same router....
  8. Backup apps and data windows 10

    in Windows 10 Ask Insider
    Backup apps and data windows 10: I want to backup my apps and data on windows 10 and do a clean install. submitted by /u/Re-Evolution7 [link] [comments] https://www.reddit.com/r/Windows10/comments/ettvup/backup_apps_and_data_windows_10/
  9. Windows 10 Private Network

    in Windows 10 Network and Sharing
    Windows 10 Private Network: How do I make my Windows 10 computer visible to other computers on my home network ? https://answers.microsoft.com/en-us/windows/forum/all/windows-10-private-network/e56997e6-c426-4545-af88-4d6ab446bce3
  10. Clearing (and restoring) Private data

    in Windows 10 Performance & Maintenance
    Clearing (and restoring) Private data: Hi I have some Questions about „cleaning“ up or removing personal/private data & configuration from a Windows 10 PC. It is about a PC that should be sent to the Vendor to get repaired. It is not my PC but from a friend. Usually in such a case I would create an image from...