Configuration
- Add the following entries in environment variables:
- SOLR_HOST=localhost
- SOLR_PORT=8983
- SOLR_METADATA_CORE=ctmetadata\
- SOLR_BUSI_PRIV_CORE=business_private
- SOLR_BUSI_SEMIPRIV_CORE=business_semiprivate
- SOLR_BUSI_PUBLIC_CORE=business_public
- Open command prompt in bin directory (For e.g. D:\solr-7.7.0_server\solr-7.7.0\bin) of the server and execute the following command to start the server.
Command: solr start - To enable search icon in your end application, use the renderUIWidget API as follows:
canvas.renderUIWidget('SolrSearch':'#ct_search_area');
where, ct_search_area -> Position to render the widget.
This renders the Solr Search icon in the div mentioned in 2nd argument. - Reindex the Solr search so that the index points to the values currently present in the DB.
To reindex, use the following URL:
http://<host>:<port number>/<application context root>/solrIndex.jsp?actionToDo=reindex&solrId=CT_Metadata
Indexing
All the metadata such as workspaces, widgets and forms will be indexed. The solrIndex.jsp performs the following actions through actionToDo attribute.
- Index – appends to existing documents
- reindex – clears and indexes freshly
The solrId attribute (optional) can be used to denote which class the above actions need to be performed. If a class is specified, the corresponding class is taken and action is performed otherwise the action is performed on all the class in the table CT_SOLR_DATA_PROVIDER. This table contains the list of classes from where the data to be indexed is fetched.
To insert into the table CT_SOLR_DATA_PROVIDER, refer the following query
Insert into CT_SOLR_DATA_PROVIDER (APPLICATION_ID, SOLR_ID,SOLR_DATA_CLASS,CLASS_DESCRIPTION,DATA_SCOPE,TENANT_ID,LST_INDEXED_TIME,LST_REINDEXED_TIME) values ('&&APPLICATION_ID', 'CT_Metadata','com.intellectdesign.canvas.viewdefinition.solr.CTSolrDataLoader', 'Class contains the data for indexing the CT framework metadata for forms, widgets and workspaces.','public',null,null,null);
The important columns in the CT_SOLR_DATA_PROVIDER table are:
- SOLR_ID
- SOLR_DATA_CLASS
- DATA_SCOPE
- COL_MAPPING
- LST_INDEXING_TIME
- LST_REINDEXING_TIME
You can use the following commonly used attributes to customize your search mechanism:
The SOLR_DATA_CLASS denotes the class file, which is an implementation of the interface IsolrDataLoader. The interface contains two methods PopulateFields() and SendDataToIndex().
The corresponding logic is written in the class that implements this interface.Refer the following sample file to implement a logic to load and index your data.
CTSolrDataLoader.txt- The DATA_SCOPE denotes whether the business data is public, private or semi-private.
- The COL_MAPPING denotes the naming convention used for the GCIF and USERNO columns in the Canvas schema. Multiple naming conventions can be provided as comma separated values.