Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolate and externalize SOLR functionality #2201

Closed
anthonysena opened this issue Feb 7, 2023 · 1 comment · Fixed by #2196
Closed

Isolate and externalize SOLR functionality #2201

anthonysena opened this issue Feb 7, 2023 · 1 comment · Fixed by #2196
Milestone

Comments

@anthonysena
Copy link
Collaborator

This issue is based on discussion in the Atlas/WebAPI Developer Subteam from 2/7/2023 and is aimed as describing the desired state based on changes in #2196.

Currently, WebAPI has support for optionally using Apache SOLR for vocabulary search (#1091). When this functionality was introduced, we wanted to have a way for people to install/configure/manage SOLR for vocabulary search while also having the fallback to the default vocabulary search driving by SQL queries against the vocabulary daimon of a CDM.

It has been noted by @alex-odysseus, that the current implementation has a few challenges and it may be advantageous to externalize the SOLR functionality for WebAPI to a separate Java project (component). Some of the challenges include:

  • The SOLR Java components are automatically installed when you install WebAPI, even if you are not using SOLR functionality. This has implications on security patches related to SOLR - we'd want to patch these for installations that are using SOLR.
  • The current implementation in WebAPI is too concrete leading to implementation such as:

@PostConstruct
protected void init() {
// Get the SOLR cores list if enabled
if (solrSearchClient.enabled()) {
try {
availableVocabularyFullTextIndices = solrSearchClient.getCores();
} catch (Exception ex) {
log.error("SOLR Core Initialization Error: WebAPI was unable to obtain the list of available cores.", ex);
}
}
}

In the code above, the PostConstructor for the Java bean is used to determine which implementation to use - even if SOLR is not configured, it will error out which is misleading when reviewing logs. Furthermore, it locks the implementation into 2 search providers only.

Proposed state

As a first step, we'd like to change WebAPI such that the use of SOLR is driven by a profile that is used when compiling the WebAPI.war. In this way, the SOLR dependencies are then injected at compilation time and not at run time. To do this, the interfaces and implementation would be moved to an isolated part of the WebAPI code base (as is the intent of #2196). Later, this functionality would move to an external Java library.

Hoping this captures the discussion @chrisknoll, @alex-odysseus

@anthonysena
Copy link
Collaborator Author

Bringing over some additional next steps for v2.14 based on comments from @ssuvorov-fls:

next steps for 2.14:

Creating two repositories:
1.1. Repository for common classes which will be used in both webapi and solr modules
This repository will include the following classes:
org.ohdsi.webapi.vocabulary.Concept;
org.ohdsi.webapi.vocabulary.SearchProviderConfig;
org.ohdsi.webapi.vocabulary.SearchProvider;
org.ohdsi.webapi.info.ConfigurationInfo - this classes can be excluded but in this case we won't be able to get information about Solr config parameters
1.2. Repository for solr modules
org.ohdsi.webapi.vocabulary.solr.SolrSearchProvider;
org.ohdsi.webapi.vocabulary.solr.SolrSearchClient;
org.ohdsi.webapi.vocabulary.solr.SolrConfigurationInfo;

Adding profile to pom.xml in WebAPI

alex-odysseus added a commit to OHDSI/StandardizedAnalysisAPI that referenced this issue Sep 11, 2023
…on to a separate library OHDSI/WebAPI#2201

Based on the idea OHDSI/WebAPI#2196
Referencing the latest Standardized Analysis Utils and Circe
1.5.0 release preparation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant