Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Lucene.NET port for MonoTouch

roycornelissenroycornelissen USInsider, University, Developer Group Leader ✭✭

Does anyone know of a Lucene.NET port that works in MonoTouch and Mono for Android? I'd like to research the possibilities of using this for in app searches. Do the heavy lifting of indexing server side and then use the index on the device for searching.

Any thoughts?

Posts

  • NicWiseNicWise NZMember, Insider, Beta mod

    Could work, and I've thought down the same lines myself. I doubt they use anything which is not MT compatible, as it's mostly a Java port (so less change of Reflection.Emit)

    Grab source, build, try?

    I'd guess that RAM usage would be the major problem, but if your index is smallish....

    (my thought process was around RavenDB: use sqlite for key-val storage of JSON, use Lucene.NET to index and search the data)

  • roycornelissenroycornelissen USInsider, University, Developer Group Leader ✭✭

    With thanks to @wmeints for breaking some ground by doing a port to Mono for Android, I've ported Lucene.NET to MonoTouch as well. Turned out to be quite easy.

    See: https://github.com/roycornelissen/lucene.net

    The sample app works, haven't tried any extensive things yet, and the memory pressure also has to be investigated. But still... :)

  • WMeintsWMeints NLMember, Insider

    The mono for android version can be found here: https://github.com/wmeints/lucene.net

    Next up is to find out what exactly it is going to do to the battery lifetime, the performance of the phone and the memory usage. We'll see :)

  • ChristianRishjChristianRishj DKMember

    A lightweight alternative is FTS4 in SQLite. Works well with Xamarin.iOS, and I would imagine the same applies to Android.

  • JonathanDickJonathanDick CAXamarin Team, Developer Group Leader Xamurai

    I remember talking to someone about this awhile ago. They said they had no big problems getting it to work, but obviously memory is constrained on these devices, and that's where they had problems doing anything on a big scale, so just watch out for memory usage :)

  • chriguchrigu USMember ✭✭
    edited July 2014

    Hi there,

    I successfully used the stable Lucene.net v.3.0.3 for a big iOS project. It works really well also with advanced filtering, sorting, field weights, fuzzy -and faceted search. We index approx. 30'000 documents with ~20 fields and the performance is still very good (~2s to deliver search results on an iPhone 4s). I didn't yet test it on Android but afaik it will work too.
    Hopefully, there will be a blog post soon.

  • roycornelissenroycornelissen USInsider, University, Developer Group Leader ✭✭

    Sounds awesome @chrigu‌! I look forward to your blogpost. I have a use case coming up in my project where this might be a good solution too.

  • KentBoogaartKentBoogaart AUMember ✭✭

    Not sure if necroposting is discouraged here, but I'm interested in hearing from @chrigu (or anyone else) about your experience converting Lucene.NET to a PCL. I'm currently staring at 433 build errors after copying the core library to a PCL project. Could you please elaborate on how you got Lucene.NET running on iOS?

  • KentBoogaartKentBoogaart AUMember ✭✭

    I just found https://github.com/chrigu-ebert/Xamarin-Lucene.Net, which looks like it might be what I want.

  • AnujSingh.9347AnujSingh.9347 USMember

    Hi ,
    @chrigu

    Actually my requirement is to run Lucene indexing and searching in my application for all mobile platforms like ios, android and UWP. but above library resolved my error in android app only when the same library if i am using in uwp project giving me following errors:

    Error CS7069 Reference to type 'DirectoryInfo' claims it is defined in 'mscorlib', but it could not be found LuceneWindowsTesting.UWP
    Error CS7069 Reference to type 'MarshalByRefObject' claims it is defined in 'mscorlib', but it could not be found LuceneWindowsTesting.UWP
    Please suggest any workaround for the above problem.

    Thanks in Advance

  • chriguchrigu USMember ✭✭

    Hi there,

    @KentBoogaart Sorry I was quite absorbed with other projects. I wrote a blogpost some time ago. You can find it here: https://blog.liip.ch/archive/2014/12/15/using-a-powerful-and-full-featured-search-engine-on-mobile-platforms.html

    @AnujSingh.9347 I tested my Github code only on iOS but in theory It should work on Android too. So you tried to use my code to build an UWP app? Or you got that error when targeting Android?

    I have no experience in building UWP apps but I might be able to reproduce if it is an Android problem. But I need more info on this :)

Sign In or Register to comment.