Lucene in Android

纵然是瞬间 提交于 2020-01-09 10:29:45

问题


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?


回答1:


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.




回答2:


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




回答3:


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



回答4:


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.




回答5:


I think this demo app will work for you.

https://github.com/weiweiwang/quickdialer

It has:

  • fast T9 search
  • support 5000 contacts
  • 500 calllogs


来源:https://stackoverflow.com/questions/7821103/lucene-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!