Using Alfresco Community - 5.0.0 version.
Use Case: For fetching documents we want to query Solr first then DB.
First I've tried below properties in alfresco-global.properties file:
solr.query.cmis.queryConsistency=EVENTUAL
solr.query.fts.queryConsistency=EVENTUAL
After the above changes, I was able to see logs that it was using Solr to execute Query and getting all the documents. But for some specific query, it returned no records.
So, for fixing above specific scenario, I've changed these from EVENTUAL to HYBRID.
solr.query.cmis.queryConsistency=HYBRID
solr.query.fts.queryConsistency=HYBRID
After these changes, there were no logs related to Solr or DB query and not getting any documents on UI.
After seeing the code of the DbOrIndexSwitchingQueryLanguage class, found that hybridEnabled attribute should be true for executing this case.
Can anybody suggest me how to set hybridEnabled true if this fixes my problem or suggest anything else to resolve my use case?
It looks like you have already looked into the source code, so you might have seen the property solr.query.hybrid.enabled used to configure to property you mentioned from the DbOrIndexSwitchingQueryLanguage class.
As far as I know, the HYBRID mode is not officially supported / recommended. In fact, the documentation even mentions that in the page about the admin console configuration page for SOLR.
If I use queryConsistency=EVENTUAL then it'll hit the Solr.
If queryConsistency=HYBRID then it'll hit Solr and DB.
Is there any way to hit Solr first and if there are no results from Solr then it'll query the DB?
There is no such option and no way to do that, unless you were to completely replace the DbOrIndexSwitchingQueryLanguage implementation.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.