I am interested in using the suggest feature against a composition of other 
more granular facets. Let me provide an example to help explain my problem and 
proposed approaches.

Say I have a set of facets for these artifacts:
   <field name="city" type="string" indexed="true" stored="true" />
   <field name="state" type="string" indexed="true" stored="true" />
   <field name="zipcode" type="string" indexed="true" stored="true" />

So far things work OK. Now I want my suggest feature to work on a composition 
equivalent to 

    {city}, {state} {zipcode}

I have these fields defined per the suggestions on adding suggest capabilities. 
I'm experimenting so I am trying both options.

   <field name="suggest_full" type="prefix_full" indexed="true" stored="true"/>
   <field name="suggest_token" type="prefix_token" indexed="true" 
stored="true"/>

I would like to 'compose' the value for these 2 suggest fields based on the 
existing 'atomic' fields. The copyField feature doesn't get me the whole way 
there but I am interested in a similar mechanism.

1) Is there an existing feature, approach, mechanism, ... to get this done that 
I'm just not aware of?

2) Assuming that #1 is 'no', then would this be a generally useful feature to 
add in? If so how would people like this to be done? 

Obviously I can push this down into the document preparation myself outside of 
Solr. I would prefer to have a mechanism to handle this in the schema.xml since 
I don't want to do any real manipulation/transformation of the data elements at 
this point. Here was an initial thought on what it might look like...

Here source is formatted similar to
java.text.MessageFormat but with named rather than indexed
substitutions so that.
    <composeField source="{city}, {state} {zipcode}" dest="suggest_full"  />
    
Here source is formatted similar to Velocity templates.
    <composeField source="$city, $state $zipcode" dest="suggest_full"  />

I am not interested in creating a new template language or pulling in a new 
dependency to get this done though (velocity, freemarker, ...) per se. I just 
want to do some simple composition. If folks think this is a good idea though, 
it could be setup like this instead.

    <composeField template="template_filename.vm" dest="suggest_full" 
class="solr.VelocityTemplateFactory" />

    template_filename.vm file contains the following line
    $city, $state $zipcode

Any feedback would be appreciated.

Thanks,

Brian

Reply via email to