java - OrientDB Lucene 索引非常慢

标签 java indexing lucene orientdb

我有一个包含 100.000 多条记录的数据库。我想用 Lucene 在两个字段上索引它们,所以我添加了以下索引:

create index Book.search on Book (title,isbn) FULLTEXT ENGINE LUCENE

但是,当我使用以下查询搜索其中一个字段时:

select from Book where [title,isbn] LUCENE "android"

查询花费了很长时间,就像在进行全表扫描一样。如果我使用解释计划,它还表明它正在这样做:

explain select from Book where [title,isbn] LUCENE "android"

结果:

{
    "result": [
        {
            "@type": "d",
            "@version": 0,
            "documentReads": 80551,
            "current": "#16:217944",
            "documentAnalyzedCompatibleClass": 80551,
            "recordReads": 80551,
            "_memoryIndex": "isbn:\n\t'[61 6c 6c 61]':1: [(1)]\n\t'[63 6f 6d 70 6c 65 74 6f]':1: [(6)]\n\t'[63 6f 6e]':1: [(3)]\n\t'[63 6f 72 73 6f]':1: [(5)]\n\t'[65 64 69 74 69 6f 6e]':1: [(15)]\n\t'[67 75 69 64 61]':1: [(0)]\n\t'[69 6d 70 61 72 61 72 65]':1: [(8)]\n\t'[69 74 61 6c 69 61 6e]':1: [(14)]\n\t'[70 65 72]':1: [(7)]\n\t'[70 6f 63 6f]':1: [(12)]\n\t'[70 72 6f 67 72 61 6d 6d 61 72 65]':1: [(10)]\n\t'[70 72 6f 67 72 61 6d 6d 61 7a 69 6f 6e 65]':1: [(2)]\n\t'[72]':1: [(4)]\n\t'[74 65 6d 70 6f]':1: [(13)]\n\tterms=14, positions=14, memory=32.9 KB\ntitle:\n\t'[31 35 33 30 30 35 38 32 33 36]':1: [(0)]\n\tterms=1, positions=1, memory=32.9 KB\n\nfields=2, terms=15, positions=15, memory=66.6 KB",
            "fetchingFromTargetElapsed": 17037,
            "evaluated": 80551,
            "user": "#5:0",
            "tips": [
                "Query 'SELECT FROM Book WHERE [title, isbn] LUCENE \"android\"' fetched more than 50000 records: to speed up the execution, create an index or change the query to use an existent index"
            ],
            "elapsed": 17040.559,
            "resultType": "collection",
            "resultSize": 848,
            "@fieldTypes": "documentReads=l,current=x,documentAnalyzedCompatibleClass=l,recordReads=l,fetchingFromTargetElapsed=l,evaluated=l,user=x,elapsed=f"
        }
    ],
    "warnings": [
        "Query 'SELECT FROM Book WHERE [title, isbn] LUCENE \"android\"' fetched more than 50000 records: to speed up the execution, create an index or change the query to use an existent index"
    ],
    "notification": "Query executed in 17.686 sec. Returned 1 record(s)"
}

我在这里错过了什么?

最佳答案

根据您的解释,没有涉及索引。所以是的,它正在进行扫描

从您的索引图片中,我看到字段是按此顺序声明的 [isbn,title]

这应该可以解决:

select count(1) from Book where [isbn,title] LUCENE "android"

关于java - OrientDB Lucene 索引非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35939814/

相关文章:

java - 如何检查一个列表是否与另一个列表具有相同的元素,能够有重复

java - 在android中制作多个http post

r - 选择 R 中数据框的最后 n 列

MATLAB 表达式列索引

sql - 匹配 SQL/BigQuery 中相同索引的数组元素

java - 扩展 Lucene 分析器

solr - Solr 4 生产准备好了吗?

java - Drools Planner 考试示例只有一个主题

java - 为 Java EE 选择开源应用服务器

lucene - 我能知道 MultiReader 从哪个索引获取文档吗?