Saturday, 15 March 2014

search - Sitecore - patch node with the same attributes as the others -



search - Sitecore - patch node with the same attributes as the others -

how can patch specified node if there several other nodes same attributes?

i need patch analyzer czech language in contentsearch section, nodes start with

<mapentry type="sitecore.contentsearch.luceneprovider.analyzers.perexecutioncontextanalyzermapentry, sitecore.contentsearch.luceneprovider">

part of configuration looks this

...</maentry> <mapentry type="sitecore.contentsearch.luceneprovider.analyzers.perexecutioncontextanalyzermapentry, sitecore.contentsearch.luceneprovider"> <param hint="executioncontext" type="sitecore.contentsearch.cultureexecutioncontext, sitecore.contentsearch"> <param hint="cultureinfo" type="system.globalization.cultureinfo, mscorlib"> <param hint="name">ar-ae</param> </param> </param> <param desc="analyzer" type="sitecore.contentsearch.luceneprovider.analyzers.defaultperfieldanalyzer, sitecore.contentsearch.luceneprovider"> <param desc="defaultanalyzer" type="lucene.net.analysis.ar.arabicanalyzer, lucene.net.contrib.analyzers"> <param hint="version">lucene_30</param> </param> </param> </mapentry> <mapentry type="sitecore.contentsearch.luceneprovider.analyzers.perexecutioncontextanalyzermapentry, sitecore.contentsearch.luceneprovider"> <param hint="executioncontext" type="sitecore.contentsearch.cultureexecutioncontext, sitecore.contentsearch"> <param hint="cultureinfo" type="system.globalization.cultureinfo, mscorlib"> <param hint="name">pt-br</param> </param> </param> <param desc="analyzer" type="sitecore.contentsearch.luceneprovider.analyzers.defaultperfieldanalyzer, sitecore.contentsearch.luceneprovider"> <param desc="defaultanalyzer" type="sitecore.contentsearch.luceneprovider.analyzers.contrib.braziliananalyzer, sitecore.contentsearch.luceneprovider"> <param hint="version">lucene_30</param> </param> </param> </mapentry> <mapentry type="sitecore.contentsearch.luceneprovider.analyzers.perexecutioncontextanalyzermapentry, sitecore.contentsearch.luceneprovider"> <param hint="executioncontext" type="sitecore.contentsearch.cultureexecutioncontext, sitecore.contentsearch"> <param hint="cultureinfo" type="system.globalization.cultureinfo, mscorlib"> <param hint="name">cs-cz</param> </param> </param> <param desc="analyzer" type="sitecore.contentsearch.luceneprovider.analyzers.defaultperfieldanalyzer, sitecore.contentsearch.luceneprovider"> <param desc="defaultanalyzer" type="lucene.net.analysis.cz.czechanalyzer, lucene.net.contrib.analyzers"> <param hint="version">lucene_30</param> </param> </param> </mapentry> <mapentry>...

and need patch (in our example) defaultanalyzer in sec node. sec node not in real life second, third, 7th etc... guess need find "mapentry" node specified inner node.

if utilize this

<map hint="list:add"> <!-- patch analyzer czech language --> <mapentry type="sitecore.contentsearch.luceneprovider.analyzers.perexecutioncontextanalyzermapentry, sitecore.contentsearch.luceneprovider"> <param desc="analyzer" type="sitecore.contentsearch.luceneprovider.analyzers.defaultperfieldanalyzer, sitecore.contentsearch.luceneprovider"> <param desc="defaultanalyzer" type="lucene.net.analysis.cz.czechanalyzer, lucene.net.contrib.analyzers"> <patch:attribute name="type">mysolution.metroasciifoldinganalyzer, mysolution</patch:attribute> </param> </param> </mapentry> </map>

it patch first node.

i found similar in issue select node based on kid node value in web.config transform, understand replace whole 1 node custom one, .... necessary?

the reply linked uses slowcheetah it's transforms, , presume trying using sitecore config patch...

because selecting node based on kid value, can utilize contains function check value. can patch specific node, can't select query. have replace whole node.

i suggest first delete existing cs-cz entry , add together in own. not had create mapentry node more unique added desc attribute, otherwise overwrites first match (in case ja-jp)

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" > <sitecore> <contentsearch> <indexconfigurations> <defaultluceneindexconfiguration> <analyzer> <param desc="map"> <map> <mapentry patch:instead="*[contains(.,'cs-cz')]"> <patch:delete /> </mapentry> <mapentry desc="cs-cz analyzer" type="sitecore.contentsearch.luceneprovider.analyzers.perexecutioncontextanalyzermapentry, sitecore.contentsearch.luceneprovider"> <param hint="executioncontext" type="sitecore.contentsearch.cultureexecutioncontext, sitecore.contentsearch"> <param hint="cultureinfo" type="system.globalization.cultureinfo, mscorlib"> <param hint="name">cs-cz</param> </param> </param> <param desc="analyzer" type="sitecore.contentsearch.luceneprovider.analyzers.defaultperfieldanalyzer, sitecore.contentsearch.luceneprovider"> <param desc="defaultanalyzer" type="mysolution.metroasciifoldinganalyzer, mysolution"> <param hint="version">lucene_30</param> </param> </param> </mapentry> </map> </param> </analyzer> </defaultluceneindexconfiguration> </indexconfigurations> </contentsearch> </sitecore> </configuration>

search attributes sitecore nodes patch

No comments:

Post a Comment