On Aug 20, 2008, at 2:19 PM, Erik Hatcher wrote:
Suppose you have a custom SearchComponent that wants to muck with
the response built prior? You can replace values in a NamedList,
but you can't remove them. Any reason we can't add this to NamedList?
/**
* Removes the name/value pair at the specified index.
* @return the value at the index removed
*/
public T remove(int idx) {
int index = (idx<<1);
nvPairs.remove(index);
return (T)nvPairs.remove(index); // same index, as things shifted
in previous remove
}
Seems reasonable to have a remove function
It brings up an interesting philosophical question - should a
SearchComponent even be allowed to muck with the response at all,
other than adding to it? But for now I'm fine with letting
components do what they want with the response.
I think they should be able to change them. For example, I could
imagine a security component that goes through and removes results
(assuming this wasn't built into searches), or an automated relevance
feedback mechanism. Seems like Solr shouldn't prevent anyone from
doing mucking if they want to muck. Such is the nature of a plugin
mechanism.
In my mind, the response isn't officially the response until it leaves
Solr (or at least not until it leaves the component handling part.)
-Grant