Uploaded image for project: 'Spring Data for Apache Solr'
  1. Spring Data for Apache Solr
  2. DATASOLR-304

Allow PropertyPlaceholders in @SolrDocument solrCoreName

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1 (Hopper SR1), 1.5.4 (Gosling SR4)
    • Fix Version/s: None
    • Component/s: Namespace
    • Labels:

      Description

      There are situations where the name of a solrCore may change in different environments. Example is a Lower Level Env (LLE) solr cluster that has cores suffixed with _dev _qa _stage, etc.

      As a developer, have the ability to use PropertyPlaceholders in solrCoreName attribute of the @SolrDocument Annotation.

      @SolrDocument(solrCoreName = "${solr.job.core}")
      public class JobDocument {
      
      	@Id
      	@Field
      	private String guid;
      
      	@Field("job_title")
      	private String jobTitle;
      
      	@Field("public_desc")
      	private String description;
      
      	public String getGuid() {
      		return guid;
      	}
      
      	public void setGuid(String guid) {
      		this.guid = guid;
      	}
      
      	public String getJobTitle() {
      		return jobTitle;
      	}
      
      	public void setJobTitle(String jobTitle) {
      		this.jobTitle = jobTitle;
      	}
      
      	public String getDescription() {
      		return description;
      	}
      
      	public void setDescription(String description) {
      		this.description = description;
      	}
      
      }
      

      My attempts to do this with the latest Gosling SR4 and Hopper SR1 yields the following error that leads me to believe this is not currently supported and warrants an improvement request.

      org.apache.solr.common.SolrException: Collection not found: ${solr.job.core}
      

        Attachments

          Activity

            People

            • Assignee:
              cstrobl Christoph Strobl
              Reporter:
              dwebb David Webb
              Last updater:
              David Webb
            • Votes:
              10 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated: