CmsSolrConfiguration
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.opencms.search.solr.CmsSolrConfiguration (Showing top 16 results out of 315)

origin: org.opencms/opencms-core

/**
 * Returns the configured Solr home directory <code>null</code> if not set.<p>
 *
 * @return the Solr home directory
 */
public String getDirectorySolr() {
  return m_solrConfig != null ? m_solrConfig.getHome() : null;
}
origin: org.opencms/opencms-core

Element solr = searchElement.addElement(N_SOLR);
CmsSolrConfiguration conf = m_searchManager.getSolrServerConfiguration();
solr.addAttribute(A_ENABLED, new Boolean(conf.isEnabled()).toString());
if (conf.getServerUrl() != null) {
  solr.addAttribute(A_SERVER_URL, conf.getServerUrl().toString());
if (conf.getHomeFolderPath() != null) {
  solr.addElement(N_HOME).addText(conf.getHomeFolderPath());
if (conf.getSolrFileName() != null) {
  solr.addElement(N_CONFIG_FILE).addText(conf.getSolrFileName());
solr.addElement(N_COMMIT_MS).addText(String.valueOf(conf.getSolrCommitMs()));
origin: org.opencms/opencms-core

if ((m_solrConfig == null) || !m_solrConfig.isEnabled()) {
if (m_solrConfig.getServerUrl() != null) {
  index.setSolrServer(new HttpSolrClient(m_solrConfig.getServerUrl()));
    m_solrConfig.getHome() + FileSystems.getDefault().getSeparator() + index.getName());
  if (!instanceDir.exists()) {
    instanceDir.mkdirs();
        index.getName() + " (" + index.getCoreName() + ")",
        index.getPath(),
        m_solrConfig.getSolrConfigFile().getAbsolutePath()),
      e);
origin: org.opencms/org.opencms.workplace.tools.searchindex

  /**
   * Returns <code>true</code> if Solr search is enabled.<p>
   *
   * @return <code>true</code> if Solr search is enabled
   */
  private boolean isSolrEnabled() {

    boolean solrEnabled = OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled();
    CmsSolrIndex solrIndex = OpenCms.getSearchManager().getIndexSolr(CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE);
    return solrEnabled && (solrIndex != null);
  }
}
origin: org.opencms/opencms-core

/**
 * Returns the Solr index schema.<p>
 *
 * @return the Solr index schema
 */
public IndexSchema getSolrSchema() {
  if (m_schema == null) {
    try {
      InputSource solrSchema = new InputSource(new FileInputStream(getSolrSchemaFile()));
      m_schema = new IndexSchema(getSolrConfig(), SOLR_SCHEMA_NAME, solrSchema);
    } catch (FileNotFoundException e) {
      CmsConfigurationException ex = new CmsConfigurationException(
        Messages.get().container(
          Messages.LOG_SOLR_ERR_SCHEMA_XML_NOT_FOUND_1,
          getSolrSchemaFile().getPath()),
        e);
      LOG.error(ex.getLocalizedMessage(), ex);
    }
  }
  return m_schema;
}
origin: org.opencms/opencms-core

/**
 * Creates the Solr core container.<p>
 *
 * @return the created core container
 */
private CoreContainer createCoreContainer() {
  CoreContainer container = null;
  try {
    // get the core container
    // still no core container: create it
    container = CoreContainer.createAndLoad(
      Paths.get(m_solrConfig.getHome()),
      m_solrConfig.getSolrFile().toPath());
    if (CmsLog.INIT.isInfoEnabled()) {
      CmsLog.INIT.info(
        Messages.get().getBundle().key(
          Messages.INIT_SOLR_CORE_CONTAINER_CREATED_2,
          m_solrConfig.getHome(),
          m_solrConfig.getSolrFile().getName()));
    }
  } catch (Exception e) {
    LOG.error(
      Messages.get().getBundle().key(
        Messages.ERR_SOLR_CORE_CONTAINER_NOT_CREATED_1,
        m_solrConfig.getSolrFile().getAbsolutePath()),
      e);
  }
  return container;
}
origin: org.opencms/opencms-core

/**
 * Returns the Solr configuration (object representation of <code>'solrconfig.xml'</code>).<p>
 *
 * @return the Solr configuration
 *
 */
public SolrConfig getSolrConfig() {
  if (m_solrConfig == null) {
    try {
      InputSource solrConfig = new InputSource(new FileInputStream(getSolrConfigFile()));
      m_solrConfig = new SolrConfig(Paths.get(getHome(), DEFAULT_CONFIGSET_FOLDER), null, solrConfig);
    } catch (FileNotFoundException e) {
      CmsConfigurationException ex = new CmsConfigurationException(
        Messages.get().container(Messages.LOG_SOLR_ERR_CONFIG_XML_NOT_FOUND_1, getSolrConfigFile()),
        e);
      LOG.error(ex.getLocalizedMessage(), ex);
    } catch (Exception e) {
      CmsConfigurationException ex = new CmsConfigurationException(
        Messages.get().container(Messages.LOG_SOLR_ERR_CONFIG_XML_NOT_READABLE_1, getSolrConfigFile()),
        e);
      LOG.error(ex.getLocalizedMessage(), ex);
    }
  }
  return m_solrConfig;
}
origin: org.opencms/opencms-core

/**
 * @see org.opencms.search.I_CmsSearchDocument#addFileSizeField(int)
 */
public void addFileSizeField(int length) {
  if (OpenCms.getSearchManager().getSolrServerConfiguration().getSolrSchema().hasExplicitField(
    CmsSearchField.FIELD_SIZE)) {
    m_doc.addField(CmsSearchField.FIELD_SIZE, new Integer(length));
  }
}
origin: org.opencms/org.opencms.workplace.tools.searchindex

/**
 * Returns select options for all configures Solr Offline indexes.<p>
 *
 * @return select options for all configures Solr Offline indexes
 */
private List<CmsSelectWidgetOption> getSolrIndexOptions() {
  List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>();
  result.add(
    new CmsSelectWidgetOption(CmsSearchReplaceSettings.VFS, true, CmsSearchReplaceSettings.VFS.toUpperCase()));
  if (OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled()) {
    for (CmsSearchIndex index : OpenCms.getSearchManager().getAllSolrIndexes()) {
      if (CmsSearchIndex.REBUILD_MODE_OFFLINE.equals(index.getRebuildMode())) {
        result.add(new CmsSelectWidgetOption(index.getName(), false, index.getName()));
      }
    }
  }
  return result;
}
origin: org.opencms/opencms-core

  fieldsToAdd.addAll(field.getCopyFields());
IndexSchema schema = OpenCms.getSearchManager().getSolrServerConfiguration().getSolrSchema();
for (String fieldName : fieldsToAdd) {
  try {
origin: org.opencms/opencms-core

  SearchType.contentValues,
  CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SERACH_TYPE_XMLCONTENT_0));
if (OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled()) {
origin: org.opencms/opencms-core

/**
 * Returns the Solr xml file, default: <code>'solr.xml'</code>.<p>
 *
 * @return the Solr xml file
 */
public File getSolrFile() {
  if (m_solrFile == null) {
    String solrFileName = m_solrFileName != null ? m_solrFileName : SOLR_CONFIG_FILE;
    m_solrFile = new File(getHome() + File.separator + solrFileName);
  }
  return m_solrFile;
}
origin: org.opencms/opencms-core

rb.doHighlights = true;
DocListAndSet res = new DocListAndSet();
SchemaField idField = OpenCms.getSearchManager().getSolrServerConfiguration().getSolrSchema().getUniqueKeyField();
origin: org.opencms/opencms-core

/**
 * Returns the solr configuration file, default: <code>'conf/solrconfig.xml'</code>.<p>
 *
 * @return the solr configuration file
 */
public File getSolrConfigFile() {
  return new File(getHome() + DEFAULT_CONFIGSET_FOLDER + CONF_FOLDER + SolrConfig.DEFAULT_CONF_FILE);
}
origin: org.opencms/opencms-core

/**
 * Public constructor.<p>
 *
 * @param luceneField
 */
public CmsSolrField(CmsLuceneField luceneField) {
  super();
  String name = luceneField.getName();
  IndexSchema schema = OpenCms.getSearchManager().getSolrServerConfiguration().getSolrSchema();
  if (schema.hasExplicitField(name)) {
    // take the lucene field name for Solr
  } else if ((luceneField.getType() != null)
    && schema.isDynamicField(luceneField.getName() + "_" + luceneField.getType())) {
    // try to use the specified type attribute as dynamic field suffix
    name = luceneField.getName() + "_" + luceneField.getType();
  } else {
    // fallback create a general_text field
    name = luceneField.getName() + "_txt";
  }
  setName(name);
  setBoost(luceneField.getBoost());
  setDefaultValue(luceneField.getDefaultValue());
  for (I_CmsSearchFieldMapping mapping : luceneField.getMappings()) {
    addMapping(mapping);
  }
}
origin: org.opencms/opencms-core

/**
 * Returns the Solr index schema file.<p>
 *
 * @return the Solr index schema file
 */
public File getSolrSchemaFile() {
  return new File(getHome() + DEFAULT_CONFIGSET_FOLDER + CONF_FOLDER + IndexSchema.DEFAULT_SCHEMA_FILE);
}
org.opencms.search.solrCmsSolrConfiguration

Javadoc

The Solr configuration class.

Most used methods

  • isEnabled
    Returns true if the Solr server is embedded, false otherwise.
  • getHome
    Returns the home directory of Solr as String.
  • getHomeFolderPath
    Returns the configured Solr home.
  • getServerUrl
    Returns the servers URL if embedded is set to false.
  • getSolrCommitMs
    Returns the max time (in ms) before a commit will happen.
  • getSolrConfig
    Returns the Solr configuration (object representation of 'solrconfig.xml').
  • getSolrConfigFile
    Returns the solr configuration file, default: 'conf/solrconfig.xml'.
  • getSolrFile
    Returns the Solr xml file, default: 'solr.xml'.
  • getSolrFileName
    Returns the Solr xml file name, default: 'solr.xml'.
  • getSolrSchema
    Returns the Solr index schema.
  • getSolrSchemaFile
    Returns the Solr index schema file.
  • getSolrSchemaFile

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • startActivity (Activity)
  • addToBackStack (FragmentTransaction)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Kernel (java.awt.image)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Reference (javax.naming)
  • JFrame (javax.swing)

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)