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 Gopesh Sharma <Go...@gensler.com> on 2018/09/03 07:51:10 UTC

Replacing Double Quotes from a field

Hello All,

I am trying to remove the double quotes from a field and that's why written PatternReplaceCharFilterFactory, but it doesn't seem to be working.

<charFilter class="solr.PatternReplaceCharFilterFactory" pattern="&quot;" replacement="$1" />

I also tried to replace it on querying time, but the SOLR throwing error that entity must be closed with >

select replace(t.name, '\"', '') as NAME from wp_31_term_taxonomy

Please let me know if I am doing anything wrong.

Re: Replacing Double Quotes from a field

Posted by Shawn Heisey <ap...@elyograg.org>.
On 9/3/2018 1:51 AM, Gopesh Sharma wrote:
> I am trying to remove the double quotes from a field and that's why written PatternReplaceCharFilterFactory, but it doesn't seem to be working.

When you say it's not working, how precisely are you checking?  If 
you're looking at the field value in search results, that will NEVER 
change because of analysis.  No matter what your analysis does, search 
results will not be affected by it.

> <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="&quot;" replacement="$1" />

Using "$1" here isn't valid.  Your pattern doesn't include any 
parentheses, which is how regex marks the groups that can then be 
accessed with $1, $2, etc.  Try using "" for the replacement instead -- 
replace a quote with the empty string.

> I also tried to replace it on querying time, but the SOLR throwing error that entity must be closed with >

There's not enough information here to troubleshoot.

> select replace(t.name, '\"', '') as NAME from wp_31_term_taxonomy

This is SQL syntax, which almost always doesn't apply to Solr.  What 
were you trying to say by including this?

Thanks,
Shawn