Package cascalog.elephantdb

Source Code of cascalog.elephantdb.KeyValIndexer

package cascalog.elephantdb;

import cascalog.Util;
import elephantdb.document.KeyValDocument;
import elephantdb.persistence.Persistence;

import java.io.IOException;

/** User: sritchie Date: 1/4/12 Time: 1:21 PM */
public class KeyValIndexer extends ClojureIndexer {

    public KeyValIndexer(Object[] spec) {
        super(spec);
    }

    public void index(Persistence lp, Object document) throws IOException {
        if(this.fn==null)
            this.fn = Util.bootFn(this.spec);

        KeyValDocument doc = (KeyValDocument) document;

        try {
            this.fn.invoke(lp, doc.key, doc.value);
        } catch(Exception e) {
            throw new RuntimeException(e);
        }
    }
}
TOP

Related Classes of cascalog.elephantdb.KeyValIndexer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.