Java 多个关键字搜索

标签 java search data-structures collections

我有一个记录列表,其中包含国家、城市、地区和建筑物名称信息(超过 50,000 条记录),其中每条记录的建筑物名称都是唯一的。

我想搜索建筑物、地区和城市。但是,如果我将国家/地区传递给方法,例如,我想获得城市列表。获取(字符串国家)。或者,如果我将国家和城市传递给该方法,则获取地区列表,例如get(字符串国家,字符串城市)。

是否有任何现有的集合/库/数据结构可以执行类似的操作?我正在考虑树状结构/ map 。我尝试了 MultiKeyMap,但它不返回值列表,而且它不是线程安全的。另外,我不想使用数据库来执行此操作。

预先感谢您的帮助。

最佳答案

SolR可能会完成您想要的工作:

Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project. Its major features include powerful full-text search, hit highlighting, faceted search, dynamic clustering, database integration, rich document (e.g., Word, PDF) handling, and geospatial search. Solr is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world's largest internet sites...

它应该允许您创建查询,从而允许您搜索记录。

您还可以通过 Solrj 与 SolR 交互:

Solrj is a java client to access solr. It offers a java interface to add, update, and query the solr index.

关于Java 多个关键字搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11663145/

相关文章:

python - 在python中构建FIFO数据结构

java - 以应用程序启动的 CDI bean

java - 想要将 long(以 TB 为单位的巨大文件大小)除以某个数字(巨大的 int)并安全地获得一个 int

java - 加载properties文件获取键值对

c# - 在两个 HashSet 中搜索

algorithm - maxheap 和在头部存储最大值的链表有什么区别?

python - 找到立方等于平方的数字对

java - 运行 spring boot jar 时找不到或加载主类

mysql - 通过查询搜索时包括父属性

algorithm - 高效的元组搜索算法