Lucene in Android

2019-01-18 13:28发布

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?

5条回答
我只想做你的唯一
2楼-- · 2019-01-18 14:11

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.

查看更多
Juvenile、少年°
3楼-- · 2019-01-18 14:16
  1. Delete "extends java.rmi.Remote" from the Class "org.apache.lucene.search.Searchable"
  2. Delete class "org.apache.lucene.search.RemoteSearchable"
查看更多
唯我独甜
4楼-- · 2019-01-18 14:18

I think this demo app will work for you.

https://github.com/weiweiwang/quickdialer

It has:

  • fast T9 search
  • support 5000 contacts
  • 500 calllogs
查看更多
够拽才男人
5楼-- · 2019-01-18 14:23

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.

查看更多
Fickle 薄情
6楼-- · 2019-01-18 14:23

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).

查看更多
登录 后发表回答