How to Upgrade Smart Previews for SmartHub

 

Prerequisite Operations

Before you run an upgrade operation for Smart Previews, perform the actions described below.

Database Backup

In a production environment, back up any production Smart Previews databases before continuing.

Collect Required Information

  • To save time, gather the following information to use during the upgrade procedures below.

  • Most of this information can be found from the web admin console. See below.

Transfer Folder

  • On your Smart Previews Settings page:
    • Record the path of your current transfer folder.
    • Note the example below:

Collection Database String

  • Under Manage databases in the farm:Record the "Configuration database" string.

Smart Previews Windows Services

  • In the Windows Services console, note the accounts listed for either:
    • Smart Previews Indexing Monitoring Service
    • Smart Previews Preview Generation Service

PreviewDataRepository Value

  1. Navigate to the directory <SmartPreviews_Install_root>/Previews Components/Previews CEWS/.
  2. Open the file CewsWindows.exe.config and note the "PreviewDataRepository" value:

Configure Environment Variables

If you are upgrading from Smart Previews v3.1 or older, note the changes to the way passwords are encrypted.

Upgrade the Import Server

Uninstall the Import Server

  1. Navigate to the Services page on your server.
  2. Stop the following Smart Previews Services:
    • Smart Previews Indexing Monitoring Service
    • Smart Previews Preview Generation Service
  3. Control Panel > Programs > Uninstall a program and uninstall Smart Previews Import Server.

Install the Import Server

  1. Open a Command Prompt as an administrator and run the following command:
       msiexec /i "path\ImportServer.msi"
  2. Follow the instructions in the installation wizard.
  3. During the installation, the following information is required:

Parameter

Description

<Install Directory>

  • Specify the path to the Smart Previews Import Server install location.

  • BA Insight recommends that you use the following location:

    • C:\Program Files (x86)\BA Insight\Smart Previews Import Server\.

<Service Account>

The Import Server service account runs as this user.

  • If possible, use a domain admin account.

  • Otherwise, the account you use must be a local admin on the server.

  • Specify the following user credentials:

    • Domain
    • User name
    • Password

Configure the Databases

Note: If a database upgrade is required, you are prompted to upgrade the database.

  • Proceed to upgrade before continuing.

  1. Go to Smart Previews Web Admin Console site from IIS Manager and select Connect to existing Configuration Database.


  2. Provide the Database Server Name and the Database Name.

    Note: If it is required, upgrade the database.

Upgrade the Fast Proxy Service

Uninstall the Fast Proxy Service

  1. Navigate to the Services page on your server. Stop the Smart Previews Fast Proxy service.
  2. Navigate to the Previews Components folder.
  3. Open the FAST Proxy folder.
  4. Right-click the unregisterproxy.bat file and select "Run as administrator" from the sub-menu that opens.

Install the Fast Proxy

  1. Navigate to where your Smart Previews upgrade package is and extract the contents of Previews Components.zip.
  2. Navigate to the Fast Proxy folder from Previews Components.
  3. Edit the file BA_insight.FastProxyService.exe.config.
  4. Locate the applicationSettings\BAInsight.FastProxyService.Properties.Settings\ConfigurationDbConnectionStringsection and add the:
    1. Data Source: Add the server name as the value.
    2. Initial Catalog: Add the Configuration Database name as the value.
  5. Locate the applicationSettings\BAInsight.FastProxyService.Properties.Settings\FastIncomingFolder and replace %LocalLow% with the path of the BA-Insight Fast Proxy Incoming folder.
  6. Run registerproxy.bat as an administrator. During the installation, an admin account is required.
  7. The user name must be filled in using the following format: Domain Name\User Name. You must also specify a password for this user.
  8. Start the service.

Upgrade the Previews CEWS Service

Uninstall the Previews CEWS service

  1. Navigate to the Services page on your server.
  2. Stop the Smart Previews CEWS service.
  3. Navigate to the Previews Components directory.
  4. Open the Previews CEWS folder.
  5. Right-click the unregistercews.bat file and run as administrator.

Install the Previews CEWS service

  1. Navigate to the Previews CEWSfolder from Previews Components.
  2. Edit the file CewsWindows.exe.config.
  3. Locate the system.serviceModel\services\service\host\baseAddressesand add or replace the server name (servername).
  4. Locate the applicationSettings\BAInsight.LongitudeCews.Properties.Settings\PreviewDataRepositoryand replace %LocalLow% with the path of the BA-Insight Fast Proxy Incoming folder.
  5. Run registercews.bat as an administrator.
    1. During the installation, an admin account is required.
    2. The user name must be filled in using the following format: Domain Name\User Name.
    3. You must also specify a password for this user.
  6. Start the service.

Upgrade Smart Previews Hybrid

Uninstall Smart Previews Hybrid .msi

  1. Go to the Control Panel > Programs > Uninstall a program.
  2. Right-click BA Insight Smart Previews Hybrid and select Uninstall.

Install Smart Previews Hybrid .msi

Open a command prompt as an administrator and run the following command:

msiexec /i "path\ SmartPreviewsHybrid.msi"

During the installation, the following information is required:

Field

Description

<InstallDir>

Specify the path where the Smart Previews site will be installed.

  • BA Insight recommends that you use this location: C:\BA Insight\Smart Previews Hybrid\.

<Port>

  • This port is used to run the website for Smart Previews.

  • For this reason, make sure the port is not used by another service.

<Certificate FriendlyName>

  • Specify the certificate friendly name that is used to set the SSL binding for this site.
  • The installer tries to access the local certificate store and look for this certificate.
  • The certificate must be installed in the Local Certificate Store, under Personal.
  • This friendly name must be associated with a certificate that is imported with a private key (.pfx) file.

<ServiceAccount>

  • Specify the User Name and the Password that is required to run the Smart Previews site.
  • This user must have READ/WRITE permissions to the Smart Previews Configuration Database.
  • The User Name must be filled in using the following format: Domain_Name\User_Name.
  • You must also specify a password for this user.

 

Configure Smart Previews Hybrid

Web.config file settings migration

DO NOT reuse your old web.config file when doing a product update or upgrade. The new web.config file contains new information.

Existing web.config settings can be preserved by using the following steps:

  1. Open your existing web.config file
  2. Open the new web.config file
  3. In your existing web.config file, copy your (modified from original) settings.
  4. Overwrite the new settings with the old in the new web.config file. Ensure new sections and content is not overwritten unnecessarily.
  1. Navigate to the Smart Previews Hybrid web site folder.
  2. Edit the web.config file.
  3. Locate the section appSettings\CloudServiceAddress.
    1. Replace the sample server address with your Smart Previews Web Resources URL, including the port number.
    2. You must include the path …./Services/PreviewProxyService.svc in your edited URL.
    3. Example:

      1. Defaulthttps://previewapp.bainsight.com/Services/PreviewProxyService.svc 

      2. After editinghttps://webresources:4321/Services/PreviewProxyService.svc

  4. Navigate to the Configuration page for Smart Previews Hybrid site: https://[SmartPreviewsAddress]/Pages/Configure.aspx
  5. Complete the fields on the page with the information from the following table:

Field

Description

<Certificate Friendly Name>

  • Specify the certificate friendly name that is used to validate or secure the requests coming from the Smart Previews Web Resources web site.
  • The certificate must be installed on a local computer under the Trusted Root Certification Authorities folder.
  • Ensure the certificate is imported using a private key.
Note: Since the request and responses must be encrypted and decrypted with the same certificate, make sure that you specify the same certificate in the Smart Previews Web Resources Configuration page.

For information on how to generate a self-signed certificate, go to How to Create a Self-Signed Certificate.

<Database Connection String>

This is the connection string for the Smart Previews Configuration database.

  • For example, Server=servername;Database=ConfigurationDatabaseName;Trusted_Connection=True;

<Preview Generation Service Address>

Specify the Previews Generation Service Address.

  • For example: http://servername:1238/PreviewGeneratorService

<Fetchers>

Required only if you are generating Previews using Connector Framework or the Cloud SSA.

  • Specify the Fetchers using these nodes.

Upgrade Smart Previews’ Web Resources

Update the Resources

  1. Navigate to IIS Manager.
  2. Expand Sites.
  3. Right-click the BAInsight SmartPreviews site and click Explore.
  4. Replace the content of this folder with the content of the unzipped SmartPreviewsFrontEnd-*.zip file.

Configure Smart Previews Web Resources Site

By default, Smart Previews Hybrid is configured to use Redis as a caching store for increased performance.

If you do not have access to a Redis cache connection, follow these steps to replace this cache with an in-memory cache:

  1. Open the web.config file.
  2. Locate the unity\containers\container\types\type section.
    1. Change the mapping to: SmartPreviewAppWeb.Caching.InMemoryStore, BAInsight.SmartPreviewsHybrid.Cloud
  3. Change the map to parameter as follows:

       From: SmartPreviewAppWeb.Caching.RedisStore, BAInsight.SmartPreviewsHybrid.Cloud

       To: SmartPreviewAppWeb.Caching.InMemoryStore, BAInsight.SmartPreviewsHybrid.Cloud


  4. Smart Previews Web Resources site must be configured to reference the SmartHub URL that is accessible from the server where the Smart Previews Web Resources are being installed.
    1. Open the web.config file.
    2. Locate the appsettings\SmartHubAddress section and change the address to match your SmartHub URL using this format: https://contoso.com
    3. Locate the appsettings\SetupModesection and change the value to SmartHub.
    4. Locate the system.serviceModel\bindings\webHttpBinding section and change the SmartHubSecurityBinding by uncommenting the SmartHub security section and commenting the other two sections.



  5. Navigate to the Configure page for Smart Previews Web Resources: https://[SmartPreviewsWebResourcesAddress]/Pages/Configure.aspx


Enter the information that is required to establish the connection with the SharePoint 2013/2016/19 component:

  1. On-premise Preview Service Address: Enter the Smart Previews Hybrid site address followed by the port where the Smart Previews Hybrid site is running.
  2. Result Source Name: Enter the local SharePoint results source name, which you created to return local results.
    1. The result source name is required to execute valid queries in order to confirm the rights of the current user who is requesting the Preview.
    2. The default value is Local SharePoint Results.
  3. Result Source Level: Specify, or leave the default value "Tenant".
  4. Certificate: Upload the .CER file.

Upgrade the Enrichment Component

Note: If Previews are generated with the SharePoint 2013/16/19 perform this step, else skip it.

Open a SharePoint Management Shell as administrator and run the following:

Upgrade
Copy
$endpoint = "http://servername:1237/ContentProcessingService"   $ssa = Get-SPEnterpriseSearchServiceApplication –Identity $ssaName - wa silentlycontinue          
   $config = New-SPEnterpriseSearchContentEnrichmentConfiguration
   $config.Endpoint = $endpoint
   $config.DebugMode = $true
   $config.Timeout = 30000
   $config.InputProperties
 = "IsDocument", "body", "Author", "Filename"
"FileType","MimeType","FileExtension","OriginalPath"
"url","ContentType","contentclass","LastModifiedTime","Size"
"escbasecrawlurl"   $config.SendRawData = $True
   $config.MaxRawDataSize = 71680
   $config.FailureMode = "Warning"   Set-SPEnterpriseSearchContentEnrichmentConfiguration –SearchApplication $ssa –ContentEnrichmentConfiguration $config

For Users Upgrading Connectivity Hub

If upgrading Connectivity Hub from version 2.0 to 2.1 or later, run the following script against your Smart Previews database before the upgrade to keep previews and content indexed synchronized.

The script can be found in the following Connectivity Hub installation directory:

  • <ConnectivityHubInstallDir>\DatabaseCreationScript\UpdateSmartPreviewsDatabases.sql

Before running the script, replace the following tokens:

  • #SmartPreviews_Configuration_DB# 
    • Put confiugration database name here.
  • #SmartPreviews_PreviewCache_DB#
    • Put preview cache database name here.
    • If your installation of Smart Previews uses multiple preview cache databases, run the script for each preview cache database separately.
  • #SmartPreviews_UserProfile_DB#
    • Put user profiles database name here.

The script below is provided for reference.

Run the script which is deployed by Connectivity Hub installer.

Script
Copy
DECLARE @batchSize int = 1000;

DECLARE @ids TABLE(Id int);
DECLARE @lastId int = 0;

USE #SmartPreviews_Configuration_DB# -- Put Configuration database name here.

PRINT 'Updating [ProcessedDocuments] table.'
WHILE @lastId = 0 OR EXISTS(SELECT 1 FROM @ids)
BEGIN
    DELETE FROM @ids;
    INSERT INTO @ids
        SELECT TOP(@batchSize) ProcessedDocumentId 
        FROM ProcessedDocuments
        WHERE DocumentUri LIKE 'spworks://%' AND ProcessedDocumentId > @lastId
        ORDER BY ProcessedDocumentId;

    SELECT @lastId = MAX(Id) FROM @ids;
    
    UPDATE ProcessedDocuments 
        SET DocumentUri = REPLACE(REPLACE(REPLACE(REPLACE(DocumentUri, '&id=&', '&'), '&subid=&', '&'), '&fid=&', '&'), '&fsubid=&', '&'),
            UriHash = CONVERT(binary(16), HASHBYTES('MD5', REPLACE(REPLACE(REPLACE(REPLACE(DocumentUri, '&id=&', '&'), '&subid=&', '&'), '&fid=&', '&'), '&fsubid=&', '&')))
        WHERE ProcessedDocumentId IN (SELECT Id FROM @ids);
END

USE #SmartPreviews_PreviewCache_DB# -- Put PreviewCache database name here.

PRINT 'Updating [DocumentContainer] table.'
SET @lastId = 0;
WHILE @lastId = 0 OR EXISTS(SELECT 1 FROM @ids)
BEGIN
    DELETE FROM @ids;
    INSERT INTO @ids
        SELECT TOP(@batchSize) DocumentContainerId 
        FROM DocumentContainer
        WHERE DocumentUri LIKE 'spworks://%' AND DocumentContainerId > @lastId
        ORDER BY DocumentContainerId;

    SELECT @lastId = MAX(Id) FROM @ids;
    
    UPDATE DocumentContainer 
        SET DocumentUri = REPLACE(REPLACE(REPLACE(REPLACE(DocumentUri, '&id=&', '&'), '&subid=&', '&'), '&fid=&', '&'), '&fsubid=&', '&')
        WHERE DocumentContainerId IN (SELECT Id FROM @ids);
END

USE #SmartPreviews_UserProfile_DB# -- Put UserProfiles database name.

PRINT 'Updating [ResearchNotebooks] table.'
SET @lastId = 0;
WHILE @lastId = 0 OR EXISTS(SELECT 1 FROM @ids)
BEGIN
    DELETE FROM @ids;
    INSERT INTO @ids
        SELECT TOP(@batchSize) ProcessedDocumentId 
        FROM ResearchNotebooks
        WHERE DocumentUri LIKE 'spworks://%' AND ProcessedDocumentId > @lastId
        ORDER BY ProcessedDocumentId;

    SELECT @lastId = MAX(Id) FROM @ids;
    
    UPDATE ResearchNotebooks 
        SET DocumentUri = REPLACE(REPLACE(REPLACE(REPLACE(DocumentUri, '&id=&', '&'), '&subid=&', '&'), '&fid=&', '&'), '&fsubid=&', '&')
        WHERE ProcessedDocumentId IN (SELECT Id FROM @ids);
END

PRINT 'Crawl URLs have been updated.'

Validate Your Upgrade

Go to your search center and run a query to see the documents that have kept the generated previews.

Verify your previews.