Sitecore Solr Index Configuration Set different root path - solr

I need add to single Solr index 2 different sitecore path /sitecore/content/System/My Path and /sitecore/content/System/My Path 2.
How I can do it in correct way ?
Should I just add new crawler description to locations section with new root value. Should I use | spliter at root section ? Or need I copy all index section with new path in root ?
<index id="my_index" type="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="name">$(id)</param>
<param desc="core">myindex</param>
<param desc="rebuildcore">myindex_swap</param>
<param desc="propertyStore" ref="contentSearch/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/countryIndexConfiguration" />
<strategies hint="list:AddStrategy">
<strategy ref="contentSearch/indexUpdateStrategies/manual" />
</strategies>
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>web</Database>
<Root>/sitecore/content/System/My Path</Root>
</crawler>
</locations>
</index>

Just copy crawler and use different tag name than the original one, e.g. crawler1. It doesn't matter what's the tag name, so you can use some more specific tag names, e.g. news or blogs. The important thing is that you can not have 2 tags with the same name under locations tag.
Sample config with 2 roots:
<locations hint="list:AddCrawler">
<news type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>web</Database>
<Root>/sitecore/content/System/news</Root>
</news>
<blogs type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>web</Database>
<Root>/sitecore/content/System/blogs</Root>
</blogs>
</locations>

We are using multiple tags with same name as crawler under locations and its working fine. It supports multiple tags with same name.

Related

How can I have a custom URL for Episerver Edit mode?

I wanted to have a custom URL for the pages displayed in edit mode.
Yes, this is possible. You need to change some places in web.config:
<episerver.packaging protectedVirtualPath="~/episerver" />
and
<applicationSettings uiUrl="~/episerver/CMS/" />
and
<virtualPathProviders> entry for ProtectedModules, <add name="ProtectedModules" virtualPath="~/episerver/" />
and all the <location> elements pointing to "episerver...".

Use Ant to find file with latest version number

I want to use ant to find the file with the latest version number. For example, I have a file directory named tomcat with the following files:
apache-tomcat-6.0.37.zip
apache-tomcat-6.0.38.zip
apache-tomcat-6.0.39.zip
I want ant to determine that apache-tomcat-6.0.39.zip is the latest file. Is there a way to do this?
Thanks!
Use resource collections, see last and sort. f.e. :
<project>
<path id="foo">
<last>
<sort>
<fileset dir="C:/some/path" includes="**/apache-tomcat-*.zip"/>
</sort>
</last>
</path>
<echo>$${foo} => ${toString:foo}</echo>
</project>
output :
[echo] ${foo} => C:\some\path\apache-tomcat-6.0.39.zip
use <pathconvert>to get file names from the relevant <fileset>.
use <sortlist> to sort the filenames in natural String order.
pick the last filename from the list.
try this:
<fileset dir="${your.base.dir}" id="one">
<include name="**/apache-tomcat-.*.zip"/>
</fileset>
<pathconvert property="orig.list" refid="one" pathsep=","/>
<sortlist property="sorted.list" value="${orig.list}" delimiter="," />
<propertyregex property="result" input="${sorted.list}" regexp=",?([^,]+?)$" select="\1"/>
inputList: <property name="one" value="a.b-2,a.b-5,a.b-1,a.b-3,a.b-4"/>
outputList: [echo] a.b-5

Why does Sling/Jackrabbit use twice the disc space to store a file?

Why does Sling/Jackrabbit use twice the disc space to store a file and what can I do to prevent it from doing this?
I'm working on a project where we're storing files and associated data in Sling. For operational reasons we would like to avoid excessive disc usage. We've hit a problem where anytime we store a file in Sling the amount of disc space used appears to be double.
For instance, I have 47 megs of files. When uploaded to Sling I have 53 megs in the datastore, there's a lot of different files so I can accept that amount of inflation. However if we look at the total size of the Jackrabbit repository we see a different story ...
jackrabbit]# du -s
118688 .
jackrabbit]# du -s repository/datastore/
53296 repository/datastore/
jackrabbit]# du -s workspaces/default/blobs/
53464 workspaces/default/blobs/
Now the data associated with these files is quite small (<1 meg) so I don't see why the workspace is storing so much data when it's supposed to be all stored in the datastore. This problem gets worse when I upload a larger file, here I've added a 277 meg file to the above repository.
jackrabbit]# du -s
686508 .
jackrabbit]# du -s repository/datastore/
337152 repository/datastore/
jackrabbit]# du -s workspaces/default/blobs/
337320 workspaces/default/blobs/
I've uploaded sets of multi gigabyte files and this behaviour seems to be consistent.
I'm using the default repository.xml file created by the Sling standalone 6 when its run, this does appear to have the FileDataStore configured (see below). I was under the impression that with the FileDataStore configured Jackrabbit wouldn't store its files in blobs but that appears to be the case here. Can anyone provide me with a reason why this behaviour is exibited or a way to disable it? It seems exceedingly strange that a system would essentially store a file twice.
<Repository>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/repository"/>
</FileSystem>
<DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/>
<Security appName="Jackrabbit">
<SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
</SecurityManager>
<AccessManager class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultAccessManager">
</AccessManager>
<LoginModule class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultLoginModule">
<param name="anonymousId" value="anonymous"/>
<param name="adminId" value="admin"/>
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
<Workspace name="${wsp.name}">
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager">
<param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
<param name="shutdownOnClose" value="false"/>
</PersistenceManager>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
<param name="supportHighlighting" value="true"/>
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/version" />
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager">
<param name="url" value="jdbc:derby:${rep.home}/version/db;create=true"/>
<param name="schemaObjectPrefix" value="version_"/>
<param name="shutdownOnClose" value="false"/>
</PersistenceManager>
</Versioning>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index"/>
<param name="supportHighlighting" value="true"/>
</SearchIndex>
</Repository>

iBatis - Why is sqlMapConfig.xml unable to find the sql maps defined in it?

I have a sqlMapConfig.xml that has three SQLMaps defined in it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<!-- Statement namespaces are required for Ibator -->
<settings enhancementEnabled="true" useStatementNamespaces="true"/>
<!-- Setup the transaction manager and data source that are
appropriate for your environment
-->
<transactionManager type="JDBC">
<dataSource type="SIMPLE" >
<property name="JDBC.Driver"
value="com.mysql.jdbc.Driver"/>
<property name="JDBC.ConnectionURL"
value="jdbc:mysql://localhost:3306/sug"/>
<property name="JDBC.Username"
value="root"/>
<property name="JDBC.Password"
value="admin"/>
</dataSource>
</transactionManager>
<!-- SQL Map XML files should be listed here -->
<sqlMap resource="com/tatakelabs/dbmaps/categories_SqlMap.xml" />
<sqlMap resource="com/tatakelabs/dbmaps/pro_SqlMap.xml" />
<sqlMap resource="com/tatakelabs/dbmaps/pro_category_SqlMap.xml" />
</sqlMapConfig>
I get a runtime error - Cause: java.io.IOException: Could not find resource com/tatakelabs/dbmaps/categories_SqlMap.xml
categories_SqlMap.xml is present in that location. I tried changing the location of the map xml, but that did not help. sqlMapConfig.xml validates against the DTD. categories_SqlMap.xml also validates against the right DTD. I am at my wits end trying to figure out why it can't find the resource. The sqlMap files are generated by iBator.
This was happening because the sqlmap file location was not getting copied to target. Added a copy goal and that fixed it.
I had the same problem. It appears the problem lies with the location of the config file. Thus, its in relation of the project resource structure.
I moved the config file in the same package as the mapper classes and it worked. In this case try moving all the resources to this package and update the resource attributes to:
<sqlMap resource="categories_SqlMap.xml" />
<sqlMap resource="pro_SqlMap.xml" />
<sqlMap resource="pro_category_SqlMap.xml" />
Solved it.
I moved the xml file to where the Pojo was located and provided the path as follows:
<sqlMap resource="com/heena/ibatis/model/jsr/jsr.xml" />
And it worked.
place it ...src\java\abc.xml under the Source Packages directory.
If you are using Spring, you can use a SqlMapClientFactoryBean specifying property "mappingLocations". In this property you can specify a generic path, such as "com/tatakelabs/dbmaps/*_SqlMap.xml" or with a variable such as ${mapfiles}, that will be resolved by Spring as an array of file names. This lets you omit sqlMap element in sqlMapConfig. This technique will run with iBatis 2.3.4 on. However sql-map-config-2.dtd is also contained inside iBatis.jar, so you can experience some parsing errors, as /com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd may have a bug. In this case you may want to replace it inside the jar with the one from the URL:
http://ibatis.apache.org/dtd/sql-map-config-2.dtd.

GAE log on localhost to file

when i debug my GAE application on localhost, how can i save the log created with Logger class to file? I can see it in console now(stderr) but dont want to redirct console to file. I found some solutions for python but cant make it work for java. Please can you help me?
Add an ApplicationAppender in your log.xml setting file:
<appender name="applicationAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="encoding" value="UTF-8"/>
<param name="file" value="C:/logs/yourlogname.log"/>
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} %-5p %l - %m%n" />
</layout>
</appender>
This is for log4j, but it is a standard logging paradigm. Also you need to have your logger definition use the appender you create.
In Linux and OSX, you can use tee to direct output to a file while still making it visible on standard out:
my_command | tee filename

Resources