private void commitDocumentChanges(String collectionName, Collection<SolrInputDocument> documents) throws SolrServerException, IOException { if (documents.size() == 0) return; try { solrClient.request(newUpdateRequest().add(documents), collectionName); } catch (HttpSolrClient.RemoteSolrException rse) { logger.error("Unable to save documents to Solr as one of the shape objects stored were not compatible with Solr.", rse); logger.error("Details in failed document batch: "); for (SolrInputDocument d : documents) { Collection<String> fieldNames = d.getFieldNames(); for (String name : fieldNames) { logger.error(name + ":" + d.getFieldValue(name).toString()); } } throw rse; } }
/** * @see org.opencms.search.I_CmsSearchDocument#getFieldNames() */ public List<String> getFieldNames() { return new ArrayList<String>(m_doc.getFieldNames()); }
/** * Pretty-print each solrDocument in the results to stdout * * @param out * @param doc */ protected static void prettyPrint(PrintStream out, SolrInputDocument doc) { List<String> sortedFieldNames = new ArrayList<String>( doc.getFieldNames()); Collections.sort(sortedFieldNames); out.println(); for (String field : sortedFieldNames) { out.println(String.format("\t%s: %s", field, doc.getFieldValues(field))); } out.println(); }
/** * Pretty-print each solrDocument in the results to stdout * * @param out * @param doc */ protected static void prettyPrint(PrintStream out, SolrInputDocument doc) { List<String> sortedFieldNames = new ArrayList<String>( doc.getFieldNames()); Collections.sort(sortedFieldNames); out.println(); for (String field : sortedFieldNames) { out.println(String.format("\t%s: %s", field, doc.getFieldValues(field))); } out.println(); }
private void commitDocumentChanges(String collectionName, Collection<SolrInputDocument> documents) throws SolrServerException, IOException { if (documents.size() == 0) return; try { solrClient.request(newUpdateRequest().add(documents), collectionName); } catch (HttpSolrClient.RemoteSolrException rse) { logger.error("Unable to save documents to Solr as one of the shape objects stored were not compatible with Solr.", rse); logger.error("Details in failed document batch: "); for (SolrInputDocument d : documents) { Collection<String> fieldNames = d.getFieldNames(); for (String name : fieldNames) { logger.error(name + ":" + d.getFieldValue(name).toString()); } } throw rse; } }
private void commitDocumentChanges(String collectionName, Collection<SolrInputDocument> documents) throws SolrServerException, IOException { if (documents.size() == 0) return; try { solrClient.request(newUpdateRequest().add(documents), collectionName); } catch (HttpSolrClient.RemoteSolrException rse) { logger.error("Unable to save documents to Solr as one of the shape objects stored were not compatible with Solr.", rse); logger.error("Details in failed document batch: "); for (SolrInputDocument d : documents) { Collection<String> fieldNames = d.getFieldNames(); for (String name : fieldNames) { logger.error(name + ":" + d.getFieldValue(name).toString()); } } throw rse; } }
private void commitChanges(String collectionName, Collection<SolrInputDocument> documents) throws SolrServerException, IOException { if (documents.size() == 0) return; try { solrClient.request(newUpdateRequest().add(documents), collectionName); } catch (final HttpSolrClient.RemoteSolrException rse) { logger.error("Unable to save documents to Solr as one of the shape objects stored were not compatible with Solr.", rse); logger.error("Details in failed document batch: "); for (final SolrInputDocument d : documents) { final Collection<String> fieldNames = d.getFieldNames(); for (final String name : fieldNames) { logger.error(name + ":" + d.getFieldValue(name)); } } throw rse; } }
SolrInputDocument sdoc2 = (SolrInputDocument) actual; if(sdoc1.getFieldNames().size() != sdoc2.getFieldNames().size()) { return false; Iterator<String> iter1 = sdoc1.getFieldNames().iterator(); Iterator<String> iter2 = sdoc2.getFieldNames().iterator();
public static String SolrDocumentToElement(SolrInputDocument doc) { Collection<String> fields = doc.getFieldNames(); for (String field : mandatoryFieldNames) { if (!fields.contains(field)) {
skipFieldsEquals.forEach(f -> d.removeField(f.getText())); if(!skipFieldsStartWith.isEmpty()) { d.getFieldNames().removeIf(name -> skipFieldsStartWith.stream() .anyMatch(skipField -> name.startsWith(skipField.getText()))); d.getFieldNames().removeIf(name -> skipFieldsEndWith.stream() .anyMatch(skipField -> name.endsWith(skipField.getText())));
@Override protected SolrInputDocument process(SolrInputDocument doc) { SolrInputDocument outputDocument = super.process(doc); Collection<String> fieldNames = new ArrayList<String>(); for (String nextFieldName : outputDocument.getFieldNames()) { fieldNames.add(nextFieldName); } List<DetectedLanguage> documentLangs = this.detectLanguage(this .concatFields(doc, this.inputFields)); for (String nextFieldName : this.prependFields) { if (indexSchema.getFieldOrNull(nextFieldName) != null) { if (indexSchema.getField(nextFieldName).getType() instanceof MultiTextField) { outputDocument = detectAndPrependLanguages(outputDocument, nextFieldName, documentLangs); } else { log.error("Invalid field " + PREPEND_FIELDS + ":" + nextFieldName + ". Field is not a " + MultiTextField.class + "."); } } else { log.error("Invalid field " + PREPEND_FIELDS + ":" + nextFieldName + ". Field does not exist in indexSchema."); } } return outputDocument; }
sdoc.getFieldNames().stream() .filter(fn -> !fn.equals(ID) && !fn.equals(TYPE) && !fn.equals("_version_") )//TODO: Add all the special fields or do the oposite check, whether it fits a dynamic Vind field .forEach( fn -> {
NamedList<NamedList<NamedList<Object>>> theTokens = new SimpleOrderedMap<NamedList<NamedList<Object>>>(); result.add(doc.getFieldValue(uniq.getName()).toString(), theTokens); for (String name : doc.getFieldNames()) { FieldType ft = schema.getFieldType(name); Analyzer analyzer = ft.getAnalyzer();
/** * The main entry point of this class. Generates a list of {@link SirenFacetEntry} for * the given {@link SolrInputDocument} by performing a DFS through the doc. * * @param doc The document for which to generate facet entries * @throws IllegalStateException if IndexSchema was not set (either in constructor or via {@link #setSchema(IndexSchema)} */ @Override public List<SirenFacetEntry> extractFacets(SolrInputDocument doc) throws FacetException { if (schema == null) { throw new IllegalStateException( "Schema field is null - probably the default constructor was used without calling setSchema() later."); } List<SirenFacetEntry> facets = new ArrayList<SirenFacetEntry>(); for (String fieldName : doc.getFieldNames()) { FieldType ft = schema.getFieldOrNull(fieldName).getType(); if (ft instanceof ExtendedJsonField) { String sirenField = (String) doc.getFieldValue(fieldName); try { JsonNode sirenNode = mapper.readTree(sirenField); generateFacetsForLeaves(sirenNode, fieldName, (ExtendedJsonField) ft, "", facets); } catch (JsonProcessingException e) { throw new FacetException("Could not parse siren field " + fieldName + ": " + e.getMessage(), e); } catch (IOException e) { throw new FacetException("I/O problem while parsing siren field " + fieldName + ": " + e.getMessage(), e); } } } return facets; }
SolrInputDocument doc = cmd.getSolrInputDocument(); if (sigFields == null || sigFields.size() == 0) { Collection<String> docFields = doc.getFieldNames(); sigFields = new ArrayList<String>(docFields.size()); sigFields.addAll(docFields);
Collection<String> fieldnames = new ArrayList<String>(doc.getFieldNames());
solr.getFieldValue(SolrFields.SOLR_RECORD_TYPE))); for (String f : solr.getSolrDocument().getFieldNames()) { SolrInputField v = solr.getSolrDocument().get(f); if (v.getValueCount() > 1) {
for (String name : doc.getFieldNames()) { for (Object val : doc.getFieldValues(name)) { params.add(ExtractingParams.LITERALS_PREFIX + name, val.toString());
for (String name : document.getFieldNames()) {