简体   繁体   中英

how lucene creates indexes from documents

I am new to lucene.I am confused about the indexing part.I have a resource where I have id,name,list of products and list of keywords. I am making name,products and keywords searchable(storing,analyzing and tokenizing them).I want to know how the indexing will be applied on my documents?Is it like a hash map as such?

Document d = new Document();
d.add(new TextField("name", cr.getData().name, Field.Store.YES));
for (int i = 0; i < cr.getData().products.size(); i++)
    d.add(new TextField("products", cr.getData().products.get(i),
    Field.Store.YES));
    for (int i = 0; i < cr.getData().keywords.size(); i++)
    d.add(new TextField("keywords", cr.getData().keywords.get(i),
                    Field.Store.YES));
        d.add(new StringField("id", cr.getData().id, Field.Store.YES));
        iw.addDocument(d);

No, this isn't a hashmap but inverted index .

First chapters of Information Retrieval book should give you more details on how this works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM