: Is there a way to add a flag (or name value pair to Json resonse) in result : being returned from Solr based on some security handling which happens in : custom post filter code? : : How about if in custom post filter code I added the information to request : context and then in a custom response builder, use that information to build : the response object? how to add this flag to the result?
You're on the right track. Take a look at the CollapseQParser (which is used as a PostFilter) and the ExpandComponent (which modifies the results after QueryComponent has run). Another helpful example to look at might be the ElevatedMarkerFactory (which is a DocTransformer) and how it uses information put in the request context by the QueryElevationComponent. Assuming you only need to add some psuedo-fields to the documents that are returned, what you'll want is probably to make your PostFilter add information to the request context similar to how CollapseQParser does, and then use that information in a custom DocTransformer. If you need to make more complex modifications to the entire response (ie: not just the individual search result documents) you'll need a custom SearchCOmponent to modify the responses -- but you'll also have to take care of merging the results of your custom SearchCOmponent in distributed (cloud) based queries. -Hoss http://www.lucidworks.com/