: If I write a custom analyser that accept a specific attribut in the
: constructor
: 
: public MyCustomAnalyzer(String myAttribute);
: 
: Is there a way to dynamically send a value for this attribute from Solr at
: index time in the XML Message ?
: 
: <add>
:   <doc>
:     <field name="content" myattribute="...">.....</field>

fundementally there are two problems with trying to add functionality like 
this into Solr...

1) the XML Update syntax is just *one* of several differnet pathways that 
data can make it into Solr, and well before it reaches your custom 
analyzer, it's converted into what is essentially just a list of triplets 
(fieldName,fieldvalue,boost).  So it would be hard to generalize out 
additional metadata attributes associated with field values in a way that 
could be generalized.

2) In Solr (and in Lucene in general) you don't get a seperate ANalyzer 
instance per field/value pair -- one Analyzer is reused over and over for 
every field=>value in a doc (and in fact: the same analyzer is used over 
and over for every document as well)

This is why people typically encode their "attributes" in the value, and 
then write their Tokenizers in such a way that it decodes that info and 
stores it as a Payload on the terms -- because even if you bypassed Solr's 
pipeline for adding documents directly from some custom RequestHandler 
that knew about your extended XML syntax, there wouldn't be anyway to pass 
that metadata to the (Long lived) Analyzer instance.



-Hoss

Reply via email to