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

solr functionalty was moved to sparate location #2196

Merged
merged 4 commits into from Feb 16, 2023
Merged

Conversation

ssuvorov-fls
Copy link
Contributor

No description provided.

@@ -1,4 +1,4 @@
package org.ohdsi.webapi.info;
package org.ohdsi.webapi.extcommon;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't move classes to new package in a minor release. 'info represents the namespace for classes that convey information about webapi to clients. extcommon sounds like some sort of 'shared extension', which is very different, and implies some sort of functionality that isn't described. Before making these types of architectural changes, they should be discussed and understood.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted moving classes to new package

@anthonysena
Copy link
Collaborator

anthonysena commented Feb 7, 2023

@ssuvorov-fls - I've created #2201 to describe this issue based on discussion with @alex-odysseus and @chrisknoll. Please review that issue and add anything I may have missed. Thanks!

@anthonysena anthonysena added this to the v2.13 milestone Feb 7, 2023
@anthonysena
Copy link
Collaborator

Linking to this PR: #1091 which is relevant to the changes that introduced SOLR functionality to the code base and also includes issues/discussions that are relevant to this set of changes too.

@anthonysena anthonysena linked an issue Feb 7, 2023 that may be closed by this pull request
@anthonysena anthonysena removed this from the v2.13 milestone Feb 7, 2023
@Autowired
VocabularyService vocabService;

@Override
public boolean supports(VocabularySearchProviderType type) {
return Objects.equals(type, VocabularySearchProviderType.DATABASE);
public boolean supports(String vocabularyVersionKey) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, it appears that the original implementation provided an API to 'ask' the instance if it supported a particular Type. Ie: if you ask the SOLRSearchProvider if it supports VocabularySearchProviderType.DATABASE, it would return false, and if you asked the DatabaseProvider if it supports VocabularySearchProviderType.SOLR, it would return false. Now, supports seems to work off of a vocabularyVersionKey. This seems like a big divergance between the semantics of the supports() function. If we want something specific for vocabulary version support, shouldn't we have a function that indicates that we're asking something related to the vocabularyVersion?


public interface SearchProvider {
boolean supports(String vocabularyVersionKey);
int getPriority();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getPriority seems out of place here: priority is a something in the context of Source and SourceDaimon. Why would a SearchProvider have a priority?

@ssuvorov-fls
Copy link
Contributor Author

@chrisknoll I've restored moved classes
next steps for 2.14:

  1. 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;

  2. Adding profile to pom.xml in WebAPI

@chrisknoll
Copy link
Collaborator

This repository will include the following classes:
org.ohdsi.webapi.vocabulary.Concept;

Perhaps the Concept class should be moved to StandardAnalysisAPI since that repo is designed to store analytic classes,

Note: I don't mean create an interface Concept (so that everyone who wants to handle Concept data they have to create their own ConceptImpl class...) The StandardAnalysisAPI can contain POJOs that represent data without behavior.

@chrisknoll
Copy link
Collaborator

My understanding of this PR is to prepare the codebase to be easier to 'extract' the SOLR implementation into a separate library such that WebAPI can be built without SOLR libraries if it isn't required.

I'm seeing at least two places that changes were made but I do not see how it applies to this function, and wanted to get clarity:

  1. The supports() method of SearchProvider changed from VocabulyarsearchProviderType to String (a vocabularyVersionKey). This seems to be adding a new feature where you can ask the search provider if it supports a vocabulary version? Was it doing something like this before? Is the change that there will be multiple SOLR cores installed with different vocabulary versions and getSearchProvider() will find the cores for that given vocabulary version? What's strange to me about this is that now people may have to pay attention more to vocabulary versions of their cores, and I don't think they had to do that in the past: you just put a core for SOLR to use and whatever version is there it would query.
  2. Related to the above, there's a hew function of 'getPriority(). Based on the above, it would seem that priority would be used to order the cores by priority, but looking at the implementation of getPriority(), it returns a constant SOLR_PRIORITY. So, is this notion of a 'priority' something new to this PR?

Additional thoughts on externalizing the search providers:

We should probably say away from using WebAPI-specific terms from the provider and interface, specifically anything related to Source. Source is something that exists only in the WebAPI domain, and to 'leak' Source-specific contexts will lead to unnecessary coupling between WebAPI and these external services.

@ssuvorov-fls
Copy link
Contributor Author

  1. It is not functionality. It is taken from VocabularySearchServiceImpl.getSearchProvider. The Solr search can't be used when there is no index for version key
  2. GetPriority is used to get appropriate search provider. Solr has higher priority and will be used instead of vocabulry search when Solr module is enabled

@chrisknoll chrisknoll merged commit f17a1b7 into master Feb 16, 2023
@delete-merged-branch delete-merged-branch bot deleted the solr_refactoring branch February 16, 2023 01:01
@chrisknoll
Copy link
Collaborator

@ssuvorov-fls I think I found an issue post-merge: When I start up the app but use the default solr settings of <solr.endpoint></solr.endpoint>, it reports an exception during startup:

org.apache.solr.client.solrj.SolrServerException: IOException occurred when talking to server at:

Looking closer at it, I'm not sure where we check in the new code the value of solr.endpoint to disable the call to SOLR.

Can you try this on your local env?

@ssuvorov-fls
Copy link
Contributor Author

I removed it from code as I think that when we include solr starter then we need to get exception in case of lack of configuration.
But it seems that you are right and we need to check availability now
I'll create another pr with these changes

alex-odysseus added a commit to OHDSI/StandardizedAnalysisAPI that referenced this pull request 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 this pull request may close these issues.

Isolate and externalize SOLR functionality
3 participants