You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Luca Cavanna (Updated) (JIRA)" <ji...@apache.org> on 2012/03/15 17:23:38 UTC

[jira] [Updated] (SOLR-3207) Add field name validation

     [ https://issues.apache.org/jira/browse/SOLR-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luca Cavanna updated SOLR-3207:
-------------------------------

    Attachment: SOLR-3207.patch

First draft patch. I introduced a new FieldNameValidator class which is used within  the IndexSchema class to validate every field name. The new class exposes also some boolean methods which are used within the ReturnFields class, in order to apply the same rules there to detect a field name. That's needed to make sure that we accept field names that we can handle within the fl parameter.

Apparently, if you use a placeholder as field name you receive on IndexSchema the default value, which can be empty. That's why I'm allowing empty field names. I'm not even sure I understood correctly how placeholders work, can someone help me out with this?

Let me know what you think about my patch!
                
> Add field name validation
> -------------------------
>
>                 Key: SOLR-3207
>                 URL: https://issues.apache.org/jira/browse/SOLR-3207
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 4.0
>            Reporter: Luca Cavanna
>             Fix For: 4.0
>
>         Attachments: SOLR-3207.patch
>
>
> Given the SOLR-2444 updated fl syntax and the SOLR-2719 regression, it would be useful to add some kind of validation regarding the field names you can use on Solr.
> The objective would be adding consistency, allowing only field names that you can then use within fl, sorting etc.
> The rules, taken from the actual StrParser behaviour, seem to be the following: 
> - same used for java identifiers (Character#isJavaIdentifierPart), plus the use of trailing '.' and '-'
> - for the first character the rule is Character#isJavaIdentifierStart minus '$' (The dash can't be used as first character (SOLR-3191) for example)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org