package gw.solr.request uses gw.solr.utils.PLSolrUtils uses gw.solr.utils.SolrUpdateMessage uses java.lang.StringBuilder /** * Represents a Solr update request that will add or modify one of more records. */ @ReadOnly abstract class AbstractIndexRequest extends AbstractRequest implements IMessageRequest { final override function hasContent() : boolean { return hasDocuments() } override function toMessage() : String { var sb = new StringBuilder(1024) // Document type on first line, JSON packet follows sb.append(getDocumentType()) sb.append(SolrUpdateMessage.SEPARATOR) var more = false sb.append("[") for (doc in getDocumentList()) { if(more) { sb.append(",") } var jsonDoc = doc.asJSON() transformBeanVersionsToConsistency(PLSolrUtils.SOLR_UPDATE, jsonDoc) sb.append(jsonDoc.toJSONString()) more = true } sb.append("]") return sb.toString() } }