From adde64b651d69ab1a19ff07a12723aeb6a06b30e Mon Sep 17 00:00:00 2001 From: Isanka Rajapaksha <36721128+IsankaSR@users.noreply.github.com> Date: Mon, 14 Feb 2022 23:20:08 +0530 Subject: [PATCH] Revert "solr upgrade" --- .../registry/indexing/solr/SolrClient.java | 17 +- .../src/main/resources/schema.xml | 2 +- .../src/main/resources/solrconfig.xml | 599 +++++++++--------- .../solr/registry-indexing/conf/schema.xml | 2 +- .../registry-indexing/conf/solrconfig.xml | 599 +++++++++--------- pom.xml | 4 +- 6 files changed, 616 insertions(+), 607 deletions(-) diff --git a/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java b/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java index c48b1d1e1..300583e04 100755 --- a/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java +++ b/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java @@ -36,7 +36,6 @@ import org.apache.solr.common.SolrException.ErrorCode; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.core.CoreContainer; -import org.apache.solr.core.NodeConfig; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -62,7 +61,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.nio.file.Paths; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -120,7 +118,7 @@ protected SolrClient() throws IOException { // commons-io --> file utils langDir = new File(confDir, "lang"); if (!langDir.exists() && !langDir.mkdirs()) { - throw new IOException("Solr lang directory could not be created! Path: " + langDir); + throw new IOException("Solf lang directory could not be created! Path: " + langDir); } // Read the configuration file name and there destination path and stored in filePathMap @@ -131,13 +129,10 @@ protected SolrClient() throws IOException { System.setProperty(SolrConstants.SOLR_HOME_SYSTEM_PROPERTY, solrHome.getPath()); if (solrServerUrl != null && !solrServerUrl.isEmpty()) { - HttpSolrClient.Builder builder = new HttpSolrClient.Builder(solrServerUrl); - this.server = builder.build(); - log.info("Http Solr server initiated at: " + solrServerUrl); + this.server = new HttpSolrClient(solrServerUrl); + log.info("Http Sorl server initiated at: " + solrServerUrl); } else { - NodeConfig nodeConfig = new NodeConfig.NodeConfigBuilder("registry-indexing", Paths.get(solrHome.getPath())) - .build(); - CoreContainer coreContainer = new CoreContainer(nodeConfig); + CoreContainer coreContainer = new CoreContainer(solrHome.getPath()); coreContainer.load(); this.server = new EmbeddedSolrServer(coreContainer, solrCore); log.info("Default Embedded Solr Server Initialized"); @@ -491,7 +486,7 @@ private void addTenantId(int tenantId, SolrInputDocument solrInputDocument) { */ private void addRawContent(String rawContent, SolrInputDocument solrInputDocument) { if (rawContent != null && StringUtils.isNotEmpty(rawContent)) { - solrInputDocument.addField(IndexingConstants.FIELD_TEXT, rawContent); + solrInputDocument.addField(IndexingConstants.FIELD_TEXT, rawContent, 1.0f); } } @@ -508,7 +503,7 @@ private void addFieldID(int tenantId, String path, String rawContent, SolrInputD if (id == null) { id = IndexingConstants.FIELD_ID + rawContent.hashCode(); } - solrInputDocument.addField(IndexingConstants.FIELD_ID, id); + solrInputDocument.addField(IndexingConstants.FIELD_ID, id, 1.0f); } /** diff --git a/components/registry/org.wso2.carbon.registry.indexing/src/main/resources/schema.xml b/components/registry/org.wso2.carbon.registry.indexing/src/main/resources/schema.xml index f05bdc278..5c6e762b3 100644 --- a/components/registry/org.wso2.carbon.registry.indexing/src/main/resources/schema.xml +++ b/components/registry/org.wso2.carbon.registry.indexing/src/main/resources/schema.xml @@ -706,7 +706,7 @@ http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 --> + geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" /> - + - - - + + - + you can safely remove this section. --> + ${solr.hdfs.home:} - + ${solr.hdfs.confdir:} - + ${solr.hdfs.blockcache.enabled:true} + The settings used will be from the first HdfsDirectoryFactory created. --> ${solr.hdfs.blockcache.global:true} - - + + - + - + @@ -302,18 +302,18 @@ - - - - - + + + + + - @@ -327,13 +327,19 @@ IndexWriter to write its info stream to solr's log. By default, this is enabled here, and controlled through log4j.properties. --> - true - + true + + + false @@ -358,16 +364,16 @@ uncommitted changes to the index, so use of a hard autoCommit is recommended (see below). "dir" - the target directory for transaction logs, defaults to the - solr data directory. --> + solr data directory. --> ${solr.ulog.dir:} - + - - ${solr.autoCommit.maxTime:5000} - false - + + ${solr.autoCommit.maxTime:5000} + false + - - ${solr.autoSoftCommit.maxTime:1000} - + + ${solr.autoSoftCommit.maxTime:1000} + - + 1024 @@ -494,7 +500,7 @@ There are two implementations of cache available for Solr, LRUCache, based on a synchronized LinkedHashMap, and - FastLRUCache, based on a ConcurrentHashMap. + FastLRUCache, based on a ConcurrentHashMap. FastLRUCache has faster gets and slower puts in single threaded operation and thus is generally faster than LRUCache @@ -519,7 +525,7 @@ initialSize - the initial capacity (number of entries) of the cache. (see java.util.HashMap) autowarmCount - the number of entries to prepopulate from - and old cache. + and old cache. --> - + size="512" + initialSize="512" + autowarmCount="0"/> + - - + + + class="solr.search.LRUCache" + size="10" + initialSize="0" + autowarmCount="10" + regenerator="solr.NoOpRegenerator" /> true - - + A possible optimization that attempts to use a filter to + satisfy a search. If the requested sort does not include + score, then the filterCache will be checked for a filter + matching the query. If found, the filter will be used as the + source of document ids, and then the sort will be applied to + that. - + - An optimization for use with the queryResultCache. When a search - is requested, a superset of the requested number of document ids - are collected. For example, if a search for a particular query - requests matching documents 10 through 19, and queryWindowSize is 50, - then documents 0 through 49 will be collected and cached. Any further - requests in that range can be satisfied via the cache. - --> - 20 + - 200 + An optimization for use with the queryResultCache. When a search + is requested, a superset of the requested number of document ids + are collected. For example, if a search for a particular query + requests matching documents 10 through 19, and queryWindowSize is 50, + then documents 0 through 49 will be collected and cached. Any further + requests in that range can be satisfied via the cache. + --> + 20 - + 200 - Various IndexSearcher related events can trigger Listeners to - take actions. + + + --> @@ -676,7 +682,7 @@ false - + @@ -755,21 +761,21 @@ - - - explicit - 10 - text - + + explicit + 10 + text + - + - - explicit - json - true - text - + + explicit + json + true + text + @@ -913,11 +919,11 @@ sync will not be possible in the absence of this handler. --> - - true - json - true - + + true + json + true + - - explicit - - - velocity - browse - layout - Solritas - - - edismax - - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 - title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 - - text - 100% - *:* - 10 - *,score - - - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 - title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 - - text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename - 3 - - - on - true - cat - manu_exact - content_type - author_s - ipod - GB - 1 - cat,inStock - after - price - 0 - 600 - 50 - popularity - 0 - 10 - 3 - manufacturedate_dt - NOW/YEAR-10YEARS - NOW - +1YEAR - before - after - - - on - content features title name - true - html - <b> - </b> - 0 - title - 0 - name - 3 - 200 - content - 750 - - - on - false - 5 - 2 - 5 - true - true - 5 - 3 - - - - - spellcheck - + + explicit + + + velocity + browse + layout + Solritas + + + edismax + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 + + text + 100% + *:* + 10 + *,score + + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 + + text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename + 3 + + + on + true + cat + manu_exact + content_type + author_s + ipod + GB + 1 + cat,inStock + after + price + 0 + 600 + 50 + popularity + 0 + 10 + 3 + manufacturedate_dt + NOW/YEAR-10YEARS + NOW + +1YEAR + before + after + + + on + content features title name + true + html + <b> + </b> + 0 + title + 0 + name + 3 + 200 + content + 750 + + + on + false + 5 + 2 + 5 + true + true + 5 + 3 + + + + + spellcheck + @@ -1087,10 +1093,10 @@ - @@ -1123,7 +1129,7 @@ field value analysis will be marked as "matched" for every token that is produces by the query analysis --> - @@ -1156,18 +1162,19 @@ request parameter that holds the query text to be analyzed. It also supports the "analysis.showmatch" parameter which when set to true, all field tokens that match the query tokens will be marked - as a "match". + as a "match". --> - - + - explicit - true + explicit + true - + - + + + + http://wiki.apache.org/solr/SpellCheckComponent + --> text_general @@ -1333,11 +1340,11 @@ .01 --> - + wordbreak - solr.WordBreakSolrSpellChecker + solr.WordBreakSolrSpellChecker name true true @@ -1382,7 +1389,7 @@ --> - + - DocumentDictionaryFactory + DocumentDictionaryFactory cat price string @@ -1561,7 +1568,7 @@ clustering - + - + true false - + terms @@ -1616,7 +1623,7 @@ - @@ -1627,7 +1634,7 @@ - @@ -1640,7 +1647,7 @@ - @@ -1650,24 +1657,24 @@ - - - + - - + - - + - - ]]> - - @@ -1699,8 +1706,8 @@ .,!? - - @@ -1722,7 +1729,7 @@ http://wiki.apache.org/solr/UpdateRequestProcessor - --> + --> - + - + - + - + text/plain; charset=UTF-8 - + - - + + - - + + @@ -1885,7 +1892,7 @@ EditorialMarkerFactory will do exactly that: --> - + diff --git a/features/content-search/org.wso2.carbon.registry.contentsearch.server.feature/src/main/resources/solr/registry-indexing/conf/schema.xml b/features/content-search/org.wso2.carbon.registry.contentsearch.server.feature/src/main/resources/solr/registry-indexing/conf/schema.xml index f05bdc278..5c6e762b3 100755 --- a/features/content-search/org.wso2.carbon.registry.contentsearch.server.feature/src/main/resources/solr/registry-indexing/conf/schema.xml +++ b/features/content-search/org.wso2.carbon.registry.contentsearch.server.feature/src/main/resources/solr/registry-indexing/conf/schema.xml @@ -706,7 +706,7 @@ http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 --> + geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" /> - + - - - + + - + you can safely remove this section. --> + ${solr.hdfs.home:} - + ${solr.hdfs.confdir:} - + ${solr.hdfs.blockcache.enabled:true} + The settings used will be from the first HdfsDirectoryFactory created. --> ${solr.hdfs.blockcache.global:true} - - + + - + - + @@ -302,18 +302,18 @@ - - - - - + + + + + - @@ -327,13 +327,19 @@ IndexWriter to write its info stream to solr's log. By default, this is enabled here, and controlled through log4j.properties. --> - true - + true + + + false @@ -358,16 +364,16 @@ uncommitted changes to the index, so use of a hard autoCommit is recommended (see below). "dir" - the target directory for transaction logs, defaults to the - solr data directory. --> + solr data directory. --> ${solr.ulog.dir:} - + - - ${solr.autoCommit.maxTime:5000} - false - + + ${solr.autoCommit.maxTime:5000} + false + - - ${solr.autoSoftCommit.maxTime:1000} - + + ${solr.autoSoftCommit.maxTime:1000} + - + 1024 @@ -494,7 +500,7 @@ There are two implementations of cache available for Solr, LRUCache, based on a synchronized LinkedHashMap, and - FastLRUCache, based on a ConcurrentHashMap. + FastLRUCache, based on a ConcurrentHashMap. FastLRUCache has faster gets and slower puts in single threaded operation and thus is generally faster than LRUCache @@ -519,7 +525,7 @@ initialSize - the initial capacity (number of entries) of the cache. (see java.util.HashMap) autowarmCount - the number of entries to prepopulate from - and old cache. + and old cache. --> - + size="512" + initialSize="512" + autowarmCount="0"/> + - - + + + class="solr.search.LRUCache" + size="10" + initialSize="0" + autowarmCount="10" + regenerator="solr.NoOpRegenerator" /> true - - + A possible optimization that attempts to use a filter to + satisfy a search. If the requested sort does not include + score, then the filterCache will be checked for a filter + matching the query. If found, the filter will be used as the + source of document ids, and then the sort will be applied to + that. - + - An optimization for use with the queryResultCache. When a search - is requested, a superset of the requested number of document ids - are collected. For example, if a search for a particular query - requests matching documents 10 through 19, and queryWindowSize is 50, - then documents 0 through 49 will be collected and cached. Any further - requests in that range can be satisfied via the cache. - --> - 20 + - 200 + An optimization for use with the queryResultCache. When a search + is requested, a superset of the requested number of document ids + are collected. For example, if a search for a particular query + requests matching documents 10 through 19, and queryWindowSize is 50, + then documents 0 through 49 will be collected and cached. Any further + requests in that range can be satisfied via the cache. + --> + 20 - + 200 - Various IndexSearcher related events can trigger Listeners to - take actions. + + + --> @@ -676,7 +682,7 @@ false - + @@ -755,21 +761,21 @@ - - - explicit - 10 - text - + + explicit + 10 + text + - + - - explicit - json - true - text - + + explicit + json + true + text + @@ -913,11 +919,11 @@ sync will not be possible in the absence of this handler. --> - - true - json - true - + + true + json + true + - - explicit - - - velocity - browse - layout - Solritas - - - edismax - - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 - title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 - - text - 100% - *:* - 10 - *,score - - - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 - title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 - - text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename - 3 - - - on - true - cat - manu_exact - content_type - author_s - ipod - GB - 1 - cat,inStock - after - price - 0 - 600 - 50 - popularity - 0 - 10 - 3 - manufacturedate_dt - NOW/YEAR-10YEARS - NOW - +1YEAR - before - after - - - on - content features title name - true - html - <b> - </b> - 0 - title - 0 - name - 3 - 200 - content - 750 - - - on - false - 5 - 2 - 5 - true - true - 5 - 3 - - - - - spellcheck - + + explicit + + + velocity + browse + layout + Solritas + + + edismax + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 + + text + 100% + *:* + 10 + *,score + + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 + + text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename + 3 + + + on + true + cat + manu_exact + content_type + author_s + ipod + GB + 1 + cat,inStock + after + price + 0 + 600 + 50 + popularity + 0 + 10 + 3 + manufacturedate_dt + NOW/YEAR-10YEARS + NOW + +1YEAR + before + after + + + on + content features title name + true + html + <b> + </b> + 0 + title + 0 + name + 3 + 200 + content + 750 + + + on + false + 5 + 2 + 5 + true + true + 5 + 3 + + + + + spellcheck + @@ -1087,10 +1093,10 @@ - @@ -1123,7 +1129,7 @@ field value analysis will be marked as "matched" for every token that is produces by the query analysis --> - @@ -1156,18 +1162,19 @@ request parameter that holds the query text to be analyzed. It also supports the "analysis.showmatch" parameter which when set to true, all field tokens that match the query tokens will be marked - as a "match". + as a "match". --> - - + - explicit - true + explicit + true - + - + + + + http://wiki.apache.org/solr/SpellCheckComponent + --> text_general @@ -1333,11 +1340,11 @@ .01 --> - + wordbreak - solr.WordBreakSolrSpellChecker + solr.WordBreakSolrSpellChecker name true true @@ -1382,7 +1389,7 @@ --> - + - DocumentDictionaryFactory + DocumentDictionaryFactory cat price string @@ -1561,7 +1568,7 @@ clustering - + - + true false - + terms @@ -1616,7 +1623,7 @@ - @@ -1627,7 +1634,7 @@ - @@ -1640,7 +1647,7 @@ - @@ -1650,24 +1657,24 @@ - - - + - - + - - + - - ]]> - - @@ -1699,8 +1706,8 @@ .,!? - - @@ -1722,7 +1729,7 @@ http://wiki.apache.org/solr/UpdateRequestProcessor - --> + --> - + - + - + - + text/plain; charset=UTF-8 - + - - + + - - + + @@ -1885,7 +1892,7 @@ EditorialMarkerFactory will do exactly that: --> - + diff --git a/pom.xml b/pom.xml index 76bf8e31d..4f4711eac 100644 --- a/pom.xml +++ b/pom.xml @@ -1629,8 +1629,8 @@ 27.0-jre 1.5.3 - 8.11.1.wso2v1 - [8.11.0,8.12.0) + 5.5.5.wso2v1 + [5.5.5,5.6.0) 5.5.5.wso2v1 4.3.6.wso2v2 4.3.1.wso2v2