On 5/27/06, Mike Baranczak <[EMAIL PROTECTED]> wrote:
The problem with XMLWriter is that it combines two functions that should really be separate: retrieving the data from the index, and rendering that data as XML.
For Documents, it was more separated long ago... a List<Document> was given to SolrQueryResponse. This didn't allow for streaming very large result sets though.
This intertwining makes it impossible to manipulate the data in between those two stages.
Was your manipulation on a per-field basis (i.e. identical XML, just values manipulated?) It's hard to come up with a suitable generalization before having specific usecases. There could be some extension points where document fields are retrieved from the index... perhaps in the form of DocRetriever? Another idea might be a DocumentMutator hook that could operate on fields before a Document is added to the index or after it is retrieved. That would allow other things like copyField to be implemented, or perhaps even integration with other data-sources (say like retrieving the body of a document stored elsewhere for highlighting purposes).
Highlighting definitely shouldn't be done in a low-level, hard-coded fashion, because everyone has a different idea of what highlighting should look like.
While I agree things should be flexible enough to accommodate different highlighting styles, I think there would be huge benefit to having a decent implementation built-in by default. -Yonik
