[ 
https://issues.apache.org/jira/browse/SOLR-8113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14951432#comment-14951432
 ] 

Gus Heck commented on SOLR-8113:
--------------------------------

Thanks for the review. You make some good points. I'd probably never want to 
ask the user to repeat patterns that had to match (or want to have to write 
validation around that)... nobody will want to type the regex twice, it could 
only lead to a mistake. Maybe it's as simple as using "replacement" rather than 
dest, and documenting/validating that only one or the other should be supplied. 
If neither is supplied default to ^(.*)$ for the fieldRegex? This results in 
something like:

{code}
<processor class="solr.CloneFieldUpdateProcessorFactory">
  <lst name="source">
    <str name="typeClass">solr.StrField</str>
  </lst>
  <str name="replacement">$1_t</str> <!-- relies on default ^(.*)$ fieldRegex 
-->
</processor>{code}

for your first example. In the event they do want to specify a particular 
regex...
 
{code}
<processor class="solr.CloneFieldUpdateProcessorFactory">
  <lst name="source">
    <str name="typeClass">solr.StrField</str>
    <str name="fieldRegex">^(.*)_s$</str>
  </lst>
  <str name="replacement">$1_t</str> 
</processor>{code}

and thus your second example (with no string type) looks like this:

{code}
<processor class="solr.CloneFieldUpdateProcessorFactory">
  <lst name="source">
    <str name="fieldRegex">^(.*)_s$</str>
  </lst>
  <str name="replacement">$1_t</str>
</processor>{code}

This also seems to avoid the user needing to think about whether or not they 
should use $0 or $1. (except in some sort of funky exotic cases where they 
might be using both $0 and $1, $2, etc... which will involve them supplying a 
pattern anyway and should still work). 


> Accept replacement strings in CloneFieldUpdateProcessorFactory
> --------------------------------------------------------------
>
>                 Key: SOLR-8113
>                 URL: https://issues.apache.org/jira/browse/SOLR-8113
>             Project: Solr
>          Issue Type: Improvement
>          Components: update
>    Affects Versions: 5.3
>            Reporter: Gus Heck
>         Attachments: SOLR-8113.patch
>
>
> Presently CloneFieldUpdateProcessorFactory accepts regular expressions to 
> select source fields, which mirrors wildcards in the source for copyField in 
> the schema. This patch adds a counterpart to copyField's wildcards in the 
> dest attribute by interpreting the dest parameter as a regex replacement 
> string.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to