本文整理匯總了Java中org.apache.solr.common.SolrDocument.getFieldValue方法的典型用法代碼示例。如果您正苦於以下問題:Java SolrDocument.getFieldValue方法的具體用法?Java SolrDocument.getFieldValue怎麽用?Java SolrDocument.getFieldValue使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.solr.common.SolrDocument的用法示例。
在下文中一共展示了SolrDocument.getFieldValue方法的22個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: getLatestVolumeTimestamp
點讚 3
import org.apache.solr.common.SolrDocument; //導入方法依賴的package包/類
/**
* If the given SolrDocument is an anchor, retrieve the latest DATEUPDATED timestamp value from its volumes.
*
* @param anchorDoc
* @param untilTimestamp
* @return
* @throws SolrServerException
*/
public long getLatestVolumeTimestamp(SolrDocument anchorDoc, long untilTimestamp) throws SolrServerException {
if (anchorDoc.getFieldValue(SolrConstants.ISANCHOR) != null && (Boolean) anchorDoc.getFieldValue(SolrConstants.ISANCHOR)) {
SolrDocumentList volumes = search(SolrConstants.ISWORK + ":true AND " + SolrConstants.IDDOC_PARENT + ":" + (String) anchorDoc
.getFieldValue(SolrConstants.IDDOC));
if (volumes != null) {
long latest = 0;
for (SolrDocument volume : volumes) {
long volumeTimestamp = getLatestValidDateUpdated(volume, untilTimestamp);
if (latest < volumeTimestamp) {
latest = volumeTimestamp;
}
}
if (latest > 0) {
return latest;
}
}
}
return -1;
}
開發者ID:intranda,項目名稱:goobi-viewer-connector,代碼行數:30,
示例2: prepareUpdate
點讚 3
import org.apache.solr.common.SolrDocument; //導入方法依賴的package包/類
/**
* Prepares the given record for an update. Creation timestamp is preserved. A new update timestamp is added, child docs are removed.
*
* @param indexObj {@link IndexObject}
* @throws IOException -
* @throws SolrServerException
* @throws FatalIndexerException
*/
private void prepareUpdate(IndexObject indexObj) throws IOException, SolrServerException, FatalIndexerException {
String pi = indexObj.getPi().trim();
SolrDocumentList hits = hotfolder.getSolrHelper().search(SolrConstants.PI + ":" + pi, null);
if (hits != null && hits.getNumFound() > 0) {
logger.debug("This file has already been indexed, initiating an UPDATE instead...");
indexObj.setUpdate(true);
SolrDocument doc = hits.get(0);
// Set creation timestamp, if exists (should never be updated)
Object dateCreated = doc.getFieldValue(SolrConstants.DATECREATED);
if (dateCreated != null) {
// Set creation timestamp, if exists (should never be updated)
indexObj.setDateCreated((Long) dateCreated);
}
// Set update timestamp
Collection dateUpdatedValues = doc.getFieldValues(SolrConstants.DATEUPDATED);
if (dateUpdatedValues != null) {
for (Object date : dateUpdatedValues) {
indexObj.getDateUpdated().add((Long) date);
}
}
// Recursively delete all children
deleteWithPI(pi, false, hotfolder.getSolrHelper());
}
}
開發者ID:intranda,項目名稱:goobi-viewer-indexer,代碼行數:33,
示例3: updateDoc
點讚 3
import org.apache.solr.common.SolrDocument; //導入方法依賴的package包/類
/**
* Performs an atomic update of the given solr document. Updates defined in partialUpdates will be applied to the existing document without making
* any changes to other fields.
*
* @param doc
* @param partialUpdates Map of update operations (usage: Map>)
* @return
* @throws FatalIndexerException
* @should update doc correctly
* @should add GROUPFIELD if original doc doesn't have it
*/
public boolean updateDoc(SolrDocument doc, Map> partialUpdates) throws FatalIndexerException {
String iddoc = (String) doc.getFieldValue(SolrConstants.IDDOC);
SolrInputDocument newDoc = new SolrInputDocument();
newDoc.addField(SolrConstants.IDDOC, iddoc);
if (!doc.containsKey(SolrConstants.GROUPFIELD)) {
logger.warn("Document to update {} doesn't contain {} adding now.", iddoc, SolrConstants.GROUPFIELD);
Map update = new HashMap<>();
update.put("set", iddoc);
newDoc.addField(SolrConstants.GROUPFIELD, update);
}
for (String field : partialUpdates.keySet()) {
newDoc.addField(field, partialUpdates.get(field));
}
if (writeToIndex(newDoc)) {
commit(false);
return true;
}
return false;
}
開發者ID:intranda,項目名稱:goobi-viewer-indexer,代碼行數:32,
示例4: getString
點讚 3
import org.apache.solr.common.SolrDocument; //導入方法依賴的package包/類
/**
* Safely gets a String for the given field.
*
* @param solrDocument the docoument to get the field from
* @param field the field to get
* @return the String value of the field
*/
default String getString(SolrDocument solrDocument, String field) {
String returnVal = null;
final Object object = solrDocument.getFieldValue(field);
if (object != null) {
if (object instanceof String) {
returnVal = (String) object;
} else if (object instanceof ArrayList) {
Collection objects = solrDocument.getFieldValues(field);
if (objects.size() > 0) {
returnVal = (String) objects.iterator().next();
}
} else {
returnVal = object.toString();
}
}
return returnVal;
}
開發者ID:bbende,項目名稱:tripod,代碼行數:25,
示例5: getAnchorTitle
點讚 2
import org.apache.solr.common.SolrDocument; //導入方法依賴的package包/類
private static String getAnchorTitle(SolrDocument doc, SolrSearchIndex solr) throws SolrServerException {
String iddocParent = (String) doc.getFieldValue(SolrConstants.IDDOC_PARENT);
SolrDocumentList hits = solr.search(SolrConstants.IDDOC + ":" + iddocParent);
if (hits != null && !hits.isEmpty()) {
return (String) hits.get(0).getFirstValue("MD_TITLE");
}
return null;
}
開發者ID:intranda,項目名稱:goobi-viewer-connector,代碼行數:10,
示例6: getEarliestRecordDatestamp
點讚 2
import org.apache.solr.common.SolrDocument; //導入方法依賴的package包/