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

Jan Høydahl commented on SOLR-9150:
-----------------------------------

bq. The type could directly be a suffix in the specified field name, with some 
separator, e.g.: "cost::int", where "cost" is the field name

I'm not a fan of overloading field name with special meaning to convey meta 
data. It's convenient since it will pass through existing code without change, 
but I'd like it to be more explicit.

As I see it, this issue is about improving Solr's field type guessing by giving 
Solr a hint about type along with the document, but still use plain field names 
such as "cost". A few ideas come to mind:
* Support this only on JSON input, infer type from the JSON type, and also 
select multiValued if array is used etc
* Provide types in a custom sidecar field {code}"_types_" : {"cost":"int", 
"desc":"string"}{code}
* Let type be encoded in value {code:xml}<field 
name="cost">{!type=int}300</field>{code}
* When Solr encounters a new field name, let it temporarily add it to schema as 
"string", tagging the docs with a special field 
{{"\_reguessfields\_":\["cost"\]}}. When enough docs have accumulated in the 
index with that new field, perform a new guess, and change type if necessary, 
reindexing all affected docs. This may require stored=true for all fields.

> Add configuration option to strip type postfix from dynamic field name on 
> document indexing
> -------------------------------------------------------------------------------------------
>
>                 Key: SOLR-9150
>                 URL: https://issues.apache.org/jira/browse/SOLR-9150
>             Project: Solr
>          Issue Type: New Feature
>          Components: Server
>    Affects Versions: 6.0
>            Reporter: Peter Horvath
>
> In some cases, incorporating field type indication to the name of a dynamic 
> field is not desirable. 
> It would be great if there was a configuration option (global, instance level 
> or collection-level), which instructed Solr to create dynamic fields with the 
> type postfix stripped. 
> For example, suppose the schema contained a dynamic field with a name of 
> "*_i". If the user attempts to index a document with a "cost_i" field, but no 
> explicit "cost_i" field is defined in the schema, then a "cost" field 
> (without "_i" postfix) would be created with the field type and analysis 
> defined for "*_i". As a result queries could be executed against the dynamic 
> field being referred to without the type indicator postfix: "cost:10"
> To retain backward compatibility, this feature should have to be enabled 
> explicitly.



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

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

Reply via email to