當前位置: 首頁>>代碼示例>>Java>>正文


Java SolrInputDocument.containsKey方法代碼示例

本文整理匯總了Java中org.apache.solr.common.SolrInputDocument.containsKey方法的典型用法代碼示例。如果您正苦於以下問題:Java SolrInputDocument.containsKey方法的具體用法?Java SolrInputDocument.containsKey怎麽用?Java SolrInputDocument.containsKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.solr.common.SolrInputDocument的用法示例。


在下文中一共展示了SolrInputDocument.containsKey方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeDocs

import org.apache.solr.common.SolrInputDocument; //導入方法依賴的package包/類
/**
 * @param aggregateRecords
 * @throws IndexerException
 * @throws FatalIndexerException
 * @see de.intranda.digiverso.presentation.solr.model.ISolrWriteStrategy#writeDocs()
 * @should write all structure docs correctly
 * @should write all page docs correctly
 */
@Override
public void writeDocs(boolean aggregateRecords) throws IndexerException, FatalIndexerException {
    if (rootDoc == null) {
        throw new IndexerException("rootDoc may not be null");
    }

    for (int order : pageOrderMap.keySet()) {
        SolrInputDocument pageDoc = pageOrderMap.get(order);
        checkAndAddAccessCondition(pageDoc);
        docsToAdd.add(pageDoc);
    }

    for (SolrInputDocument doc : docsToAdd) {
        if (doc.getFieldValue("GROUPFIELD") == null) {
            logger.error("Field has no GROUPFIELD: {}", doc.toString());
        }
        rootDoc.addChildDocument(doc);
        if (aggregateRecords) {
            if (doc.containsKey(SolrConstants.DEFAULT)) {
                rootDoc.addField(SolrConstants.SUPERDEFAULT, (doc.getFieldValue(SolrConstants.DEFAULT)));
            }
            //                if (doc.containsKey(SolrConstants.NORMDATATERMS)) {
            //                    rootDoc.addField(SolrConstants.NORMDATATERMS, doc.getFieldValue(SolrConstants.NORMDATATERMS));
            //                }
            if (doc.containsKey(SolrConstants.FULLTEXT)) {
                rootDoc.addField(SolrConstants.SUPERFULLTEXT, (doc.getFieldValue(SolrConstants.FULLTEXT)));
            }
        }
    }

    solrHelper.writeToIndex(rootDoc);
    solrHelper.commit(SolrHelper.optimize);
    logger.debug("{} new doc(s) added.", docsToAdd.size());
}
 
開發者ID:intranda,項目名稱:goobi-viewer-indexer,代碼行數:43,代碼來源:HierarchicalLazySolrWriteStrategy.java

示例2: checkAndAddAccessCondition

import org.apache.solr.common.SolrInputDocument; //導入方法依賴的package包/類
/**
 * Adds OPENACCESS access condition field value to the give doc, if it has none.
 * 
 * @param doc
 */
void checkAndAddAccessCondition(SolrInputDocument doc) {
    if (!doc.containsKey(SolrConstants.ACCESSCONDITION)) {
        doc.addField(SolrConstants.ACCESSCONDITION, SolrConstants.OPEN_ACCESS_VALUE);
    }
}
 
開發者ID:intranda,項目名稱:goobi-viewer-indexer,代碼行數:11,代碼來源:AbstractWriteStrategy.java

示例3: writeDocs

import org.apache.solr.common.SolrInputDocument; //導入方法依賴的package包/類
/**
 * @param aggregateHits
 * @throws IndexerException
 * @throws FatalIndexerException
 * @see de.intranda.digiverso.presentation.solr.model.ISolrWriteStrategy#writeDocs()
 * @should write all structure docs correctly
 * @should write all page docs correctly
 */
@Override
public void writeDocs(boolean aggregateRecords) throws IndexerException, FatalIndexerException {
    if (rootDoc == null) {
        throw new IndexerException("topDoc may not be null");
    }
    docsToAdd.add(rootDoc);
    String pi = (String) rootDoc.getFieldValue(SolrConstants.PI);
    for (int order : pageOrderMap.keySet()) {
        SolrInputDocument pageDoc = pageOrderMap.get(order);
        checkAndAddAccessCondition(pageDoc);
        docsToAdd.add(pageDoc);
        if (!pageDoc.containsKey(SolrConstants.PI_TOPSTRUCT) && pi != null) {
            pageDoc.addField(SolrConstants.PI_TOPSTRUCT, pi);
            logger.warn("Page document {} has no PI_TOPSTRUCT fields, adding now...", pageDoc.getFieldValue(SolrConstants.ORDER));
        }
        // Remove ALTO field (easier than removing all the logic involved in adding the ALTO field)
        if (pageDoc.containsKey(SolrConstants.ALTO)) {
            pageDoc.removeField(SolrConstants.ALTO);
        }
    }

    for (SolrInputDocument doc : docsToAdd) {
        if (doc.getFieldValue("GROUPFIELD") == null) {
            logger.error("Field has no GROUPFIELD: {}", doc.toString());
        }
        if (aggregateRecords) {
            if (doc.containsKey(SolrConstants.DEFAULT)) {
                rootDoc.addField(SolrConstants.SUPERDEFAULT, doc.getFieldValue(SolrConstants.DEFAULT));
            }
            //                if (doc.containsKey(SolrConstants.NORMDATATERMS)) {
            //                    rootDoc.addField(SolrConstants.NORMDATATERMS, doc.getFieldValue(SolrConstants.NORMDATATERMS));
            //                }
            if (doc.containsKey(SolrConstants.FULLTEXT)) {
                rootDoc.addField(SolrConstants.SUPERFULLTEXT, doc.getFieldValue(SolrConstants.FULLTEXT));
            }
        }
    }

    if (!docsToAdd.isEmpty()) {
        solrHelper.writeToIndex(docsToAdd);
        solrHelper.commit(SolrHelper.optimize);
        logger.debug("{} new doc(s) added.", docsToAdd.size());
    } else {
        throw new IndexerException("No docs to write");
    }
}
 
開發者ID:intranda,項目名稱:goobi-viewer-indexer,代碼行數:55,代碼來源:LazySolrWriteStrategy.java


注:本文中的org.apache.solr.common.SolrInputDocument.containsKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。