7

How can I do very fast full text search on windows phone 7?

I know of C libraries that can do this- is there any way I can interface to a C library for this?

Are there any databases for windows phone 7 that offer full text searching capability? Besides the databases mentioned in the answers, I have also come across RavenDB and FileDB, which don't have full text search.

Are there options for a .NET library for full text searching? I have come across a .NET port of the Lucene project, which would have to be ported to use Isolated Storage. There is a port that uses Azure, but that isn't what I am looking for.

Greg Weber
  • 3,228
  • 4
  • 21
  • 22
  • What do you want to search? Is there a reason you're putting a lot of content to search this way on a device? Could you not just put the content on a web based server and request the searched data from there. It would(should) be much faster to search a large amount of data on a machine which ahs the processing power and resources available for such a task. – Matt Lacey May 31 '11 at 21:15
  • Relying on a web service for core functionality seems great until the phone has flaky reception. Have you used a really good full text search tool? They don't require much CPU or memory usage because they pre-compute an inverted index. As long as the index fits on a mobile device, performance should be much better than waiting for the network latency from calling out to a web service. In my case, the sphinx full text search engine (C code) only need 7M of disk for my data set. – Greg Weber Jun 01 '11 at 01:44

2 Answers2

3

In most applications it would be best to have the documents stored on a server and use a web service to perform the full text search server-side. The phone is severely limited in terms of processing power, storage space, and IO speed, so unless you are using a very small data set you may quickly outgrow the resources available on the device.

That being said, it does not appear that any of the existing database solutions for Windows Phone support full text searching. The Sterling database engine is one of the more popular options with many standard database features, but as of right now it does not support full text searching. Rapid Repository and siaqodb are other options, however they also do not currently support full text searching. Someone has ported SQLite to Windows Phone 7, but it is based on the csharp-sqlite project, which does not support the SQLITE_ENABLE_FTS3 compiler option that is required for Full Text Searching. The next Windows Phone release code named Mango will provide developers with access to Microsoft SQL Server Compact edition, however this also does not support full text searching.

I believe your only option would be to take a .NET managed full text search engine like Lucene.net and try to port it to work in Silverlight. You would need to do a lot of refactoring, since Silverlight only allows access to Isolated Storage and not direct access to the file system. There also is strict limits on memory usage (90MB max RAM usage per app), which again will limit the size of the data-set you can use on the phone.

Greg Bray
  • 14,929
  • 12
  • 80
  • 104
  • Thanks a lot for the overview of possibilities. The memory consumption of a good search tool should at least be configurable to be far less than 90MB. The limit would then be on disk space, not memory. Anyways, I have a reasonable sized data set (7MB) that won't grow. Full text searching does not take a lot of resources in general because it uses a pre-computed inverted index. – Greg Weber Jun 01 '11 at 22:08
  • In that case, all you need is a C# based inverted index algorithm. Maybe see if this question has any leads: http://stackoverflow.com/questions/2110142/writing-an-inverted-index-in-c-for-an-information-retrieval-application – Greg Bray Jun 01 '11 at 22:27
2

From what I can tell it appears Perst allows for full text indexable searching. Not sure its exactly what you want, but check it out.

http://mobileworld.appamundi.com/blogs/andywigley/archive/2010/06/08/perst-a-database-for-windows-phone-7-silverlight-part-2.aspx

Webs
  • 163
  • 1
  • 7
  • Awesome, except for the $395 per developer license. Really excessive for a simple mobile app that may not make that money back. Note that Perst it is free for open-source use. – Greg Weber Jun 01 '11 at 02:24
  • Yea, didn't see that at first... Seems a little steep. – Webs Jun 06 '11 at 00:57