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

Shalin Shekhar Mangar commented on SOLR-993:
--------------------------------------------

bq. I am confused by the implementation of namespaces in the 
VariableResolverImpl. Why are they implemented as chained hashmaps and not flat?

There are many different types of namespaces. For example "dataimporter" which 
is used for last_index_time, request parameters, functions etc. Most of the 
variables needed to be resolved are dynamic and cannot be pre-computed. They 
are added as a Map of variable names to values just-in-time to a namespace. For 
example each of the field's values are available in the entity name's 
namespace. Two entities may have the same field name (e.g. ID is a common name 
for a primary key and can be present in more than one entities). Therefore a 
chained map gives us the flexibility of avoiding conflicts and  too many 
top-level names.

Also consider the 'functions' namespace used for Evaluators. The evaluator map 
is actually a dummy object allows us to just-in-time evaluation by overriding 
the get method.

bq. The remove method seems to treat them as flat, which seems totally 
inconsistent?
addNamespace adds a complete namespace and the removeNamespace method removes a 
complete namespace.

bq. vr.removeNamespace(null);

I think this was being used as a way to clear the resolver to prepare for the 
next document. But this is a no-op because the removeNamespace method doesn't 
do anything if the parameter is null. Need to spend some time to see if it can 
be removed or replaced with something else.

> VariableResolverImpl addNamespace overwrites entire namespace instead of 
> adding
> -------------------------------------------------------------------------------
>
>                 Key: SOLR-993
>                 URL: https://issues.apache.org/jira/browse/SOLR-993
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 1.4
>            Reporter: Jared Flatow
>             Fix For: 1.4
>
>         Attachments: SOLR-993.patch, SOLR-993b.patch
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> The addNamespace method in VariableResolverImpl does not so much add the 
> namespace as overwrite it. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to