本文整理匯總了Java中org.apache.solr.common.SolrInputDocument.removeField方法的典型用法代碼示例。如果您正苦於以下問題:Java SolrInputDocument.removeField方法的具體用法?Java SolrInputDocument.removeField怎麽用?Java SolrInputDocument.removeField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.solr.common.SolrInputDocument
的用法示例。
在下文中一共展示了SolrInputDocument.removeField方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processAdd
import org.apache.solr.common.SolrInputDocument; //導入方法依賴的package包/類
/**
* Where is where we can "interfere" with the indexing process of
* the document wrapped in the given command
*
* If we want Solr to skip the document at all, just omit this call:
*
* super.processAdd(command);
*/
@Override
public void processAdd(AddUpdateCommand command) throws IOException {
// Get the document that is going to be indexed
SolrInputDocument document = command.getSolrInputDocument();
// Removes the title field.
// In a real system, the list of fields to be removed should come from the configuration.
document.removeField("title");
// This is important: if you omit this call the document will be ignored by Solr
super.processAdd(command);
}
開發者ID:agazzarini,項目名稱:as-full-text-search-server,代碼行數:21,代碼來源:RemoveFieldUpdateRequestProcessor.java
示例2: addPageDoc
import org.apache.solr.common.SolrInputDocument; //導入方法依賴的package包/類
@Override
public void addPageDoc(SolrInputDocument doc) {
String iddoc = String.valueOf(doc.getFieldValue(SolrConstants.IDDOC));
if (doc.getField(SolrConstants.FULLTEXT) != null) {
String text = (String) doc.getFieldValue(SolrConstants.FULLTEXT);
try {
FileUtils.writeStringToFile(new File(tempFolder.toFile(), iddoc + "_" + SolrConstants.FULLTEXT), text, ENCODING_UTF8);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
doc.removeField(SolrConstants.FULLTEXT);
}
if (save(doc, iddoc)) {
int order = (int) doc.getFieldValue(SolrConstants.ORDER);
if (pageDocOrderIddocMap.get(order) != null) {
logger.error("Collision for page order {}", order);
}
pageDocOrderIddocMap.put(order, iddoc);
if (pageDocFileNameIddocMap.get(doc.getFieldValue(SolrConstants.FILENAME)) != null) {
logger.warn("A doc already exists for file: {}", doc.getFieldValue(SolrConstants.FILENAME));
}
pageDocFileNameIddocMap.put((String) doc.getFieldValue(SolrConstants.FILENAME), iddoc);
pageDocPhysIdIddocMap.put((String) doc.getFieldValue(SolrConstants.PHYSID), iddoc);
pageDocsCounter.incrementAndGet();
logger.debug("Page docs added: {}", pageDocsCounter);
}
}
示例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");
}
}