You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Zheng Lin Edwin Yeo <ed...@gmail.com> on 2018/01/04 09:59:42 UTC

Replacing \n with
using RegexReplaceProcessorFactory

Hi,

I'm using Solr 7.2.0, and I'm trying to replace \n with <br> by using
RegexReplaceProcessorFactory.

However, I could not get the below configuration in solrconfig.xml to be
loaded.

 <processor class="solr.RegexReplaceProcessorFactory">
   <str name="fieldName">content</str>
   <str name="pattern">\n  </str>
   <str name="replacement"><br></str>
</processor>

Understand that <br> is a special character. Can we do some escape sequence
to it? I have tried
\<br\>, but it does not work.

Below is the error message which I got.

Exception during parsing file:
solrconfig.xml:org.xml.sax.SAXParseException; systemId:
solrres:/solrconfig.xml; lineNumber: 1508; columnNumber: 36; The
element type "br" must be terminated by the matching end-tag "</br>".


Regards,
Edwin

Re: Replacing \n with
using RegexReplaceProcessorFactory

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Thanks Emir.

It is working now.

Regards,
Edwin

On 4 January 2018 at 18:02, Emir Arnautović <em...@sematext.com>
wrote:

> Hi Edwin,
> You need to encode <br> as &lt;br&gt;
>
> HTH,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>
>
>
> > On 4 Jan 2018, at 10:59, Zheng Lin Edwin Yeo <ed...@gmail.com>
> wrote:
> >
> > Hi,
> >
> > I'm using Solr 7.2.0, and I'm trying to replace \n with <br> by using
> > RegexReplaceProcessorFactory.
> >
> > However, I could not get the below configuration in solrconfig.xml to be
> > loaded.
> >
> > <processor class="solr.RegexReplaceProcessorFactory">
> >   <str name="fieldName">content</str>
> >   <str name="pattern">\n  </str>
> >   <str name="replacement"><br></str>
> > </processor>
> >
> > Understand that <br> is a special character. Can we do some escape
> sequence
> > to it? I have tried
> > \<br\>, but it does not work.
> >
> > Below is the error message which I got.
> >
> > Exception during parsing file:
> > solrconfig.xml:org.xml.sax.SAXParseException; systemId:
> > solrres:/solrconfig.xml; lineNumber: 1508; columnNumber: 36; The
> > element type "br" must be terminated by the matching end-tag "</br>".
> >
> >
> > Regards,
> > Edwin
>
>

Re: Replacing \n with
using RegexReplaceProcessorFactory

Posted by Emir Arnautović <em...@sematext.com>.
Hi Edwin,
You need to encode <br> as &lt;br&gt;

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 4 Jan 2018, at 10:59, Zheng Lin Edwin Yeo <ed...@gmail.com> wrote:
> 
> Hi,
> 
> I'm using Solr 7.2.0, and I'm trying to replace \n with <br> by using
> RegexReplaceProcessorFactory.
> 
> However, I could not get the below configuration in solrconfig.xml to be
> loaded.
> 
> <processor class="solr.RegexReplaceProcessorFactory">
>   <str name="fieldName">content</str>
>   <str name="pattern">\n  </str>
>   <str name="replacement"><br></str>
> </processor>
> 
> Understand that <br> is a special character. Can we do some escape sequence
> to it? I have tried
> \<br\>, but it does not work.
> 
> Below is the error message which I got.
> 
> Exception during parsing file:
> solrconfig.xml:org.xml.sax.SAXParseException; systemId:
> solrres:/solrconfig.xml; lineNumber: 1508; columnNumber: 36; The
> element type "br" must be terminated by the matching end-tag "</br>".
> 
> 
> Regards,
> Edwin