Home » Android » Lucene in Android

Lucene in Android

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m new to android and Lucene. can I use Lucene for search in android list view.
I have tried importing the package 2.3.2 and also used the jar files in library.
However, there is an error in SearchFiles.java
error is :
The type java.rmi.Remote cannot be resolved. It is indirectly referenced from .class files.

There is a possibility that this file doesnt exist for android. Is this the problem?

How to&Answers:

You may want to use the native Full Text Search feature called FTS3 in SQLite instead, which is available in Android and it is faster (since it is running natively) and uses less memory than a Java Lucene implementation under Dalvik VM.

Answer:

I’ve successfully used Lucene 3.3 for really simple search dute and it works. However, I have no idea what the memory usage impact is. In the 3.3 there is no dependency from RMI. If you need 2.3.2 and you have the source code you can free Lucene from the RMI dependency (I’ve read about a guy who succeeded in doing this).

Answer:

  1. Delete “extends java.rmi.Remote” from the Class
    “org.apache.lucene.search.Searchable”
  2. Delete class “org.apache.lucene.search.RemoteSearchable”

Answer:

Android is not java – it does not provide all standart java apis ( just look into android
reference, java.rmi is not there ). However, it is possible to import almost everrything that is pure java ( if you have enough memory ). You may try to remove unnecessary classes which cause classloading problems from jars – bu it is a lot of work.

Answer:

I think this demo app will work for you.

https://github.com/weiweiwang/quickdialer

It has:

  • fast T9 search
  • support 5000 contacts
  • 500 calllogs