0

In docker, I created the new publishing target as preview and set the new container by copying the docker-componse instructions of the CM service and removed the master connection string from this, and solr.search connection string is the same for the both CM and preview.

Now when I load a page that consumes the data from my custom index it loads fine on the CM but on the same page I check on the preview, it is not fetching the data from it.

FYI: I have logged the data to check which index is being read by the API so on both, the CM and preview, the same index is being consumed and although the solr.search connection string is still the same but the data is not coming.

Environment: Sitecore 10.3 based on docker

EDIT-1: I did not create the new indexes like sitecore_preview_master_index, sitecore_preview_web_index, etc., instead I will use the same indexes that are being used for the CM, e.g., sitecore_master_index, sitecore_web_index, and for achieving this I have kept the same solr.search connection string for CM and the new preview CD.

Summary: CM -> Pointing to mysite.master DB -> domain: https://cm.mysite.com CD -> Pointing to mysite.web DB -> domain: https://cd.mysite.com new Preview CD -> Pointing to newly created mysite.preview DB -> domain: https://preview.mysite.com

1
  • Please see update Commented Nov 13, 2023 at 9:27

1 Answer 1

2

You seem to be confusing some terminology.

A Publishing Target is a database. Out of the box, sitecore comes with one publishing target called Web. When you perform a publish and select a target, a copy of all 'publishable' items are copied from the master database to that target database.

To create a new publishing target, you need to first create a new database, add a new connection string, then add the target in the content editor. A preview target is a special type of publishing target (which you identify by checkbox when creating it in content editor) that sits outside of standard workflow behaviour.

You mention copying CM docker compose instructions and removing master connection string. What you are describing here is creating a second instance (CM). When viewed in front end, this will display data from the web database (identical to first CM). To display info from the new preview target, you need to update the web connection string on the new instance, to point to the new database.

You then mention custom indexes, yet have provided no information about how you have set these up.

When setting up a custom index, you can specify which databases that are crawled to create the index. So if you wanted one that only shows data crawled from your preview database, then you would need to configure a new one to point to the preview database or add preview to existing one and tailor your solr query accordingly to choose which database.

Apologies if I have misunderstood your question, if so please more details showing exactly how you have setup the custom index.

UPDATE

First of all, I suggest searching the main log file on your preview instance to see if there are any exceptions relating to the setting up and connewction of SOLR.

Second, navigate the config files and ensure the exact same SOLR config files are in place and that there are no role based exclusions (i.e. if the configs are for contentmanagement only and you have somehow changed the orole in web.config).

Finally, if the component you are using to call the index has no dependencies on data from the preview publishing target (i.e. DB), then it should be producing the exact same queries.

To confirm this, please navigate to the page with the component on it, then check the search.log file. The last log shown there should show the last query sent to solr from your application. This should be identical on both your CM and Preview instances.

If it is not, then the component has beeb built to call a different query, or it is somehow being influenced by what has been published to the preview database.

You can compare each query directly on the solr dashboard, by going to dashboard => select core => query ? then paste in query into the URL.

3
  • you are right, 1.) I created the new DB and added a new connection for this 2.) I copied the CM instructions to make the previewcontainer and removed the master connection string making so making it like CD, because there is no use of master connection string on CD 3.) I did not set the new indexes for it instead I am using the same solr.search connection string for both CM and preview CD so that I can use the same indexes (I have edited the question as well). 4.) Now having same solr.search connection string is not giving the index result on the preview CD but gives on CM. Commented Nov 13, 2023 at 8:02
  • Thanks @Dean OBrien I will check for the suggested pieces in the updated answer. Commented Nov 13, 2023 at 13:49
  • I closely checked every configuration there was an issue that a few of the solr index configs were not deployed on the preview CD and one of the connection string was not properly set up. So, I fixed that still the issue is not resolved but that is for a different scope, and for this scope, the progress is made with the help of your suggested areas. Thanks @Dean OBrien Commented Nov 15, 2023 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.