I’m not sure you need a custom component. Try using the standard highlighter. Configure hl.simple.pre and hl.simple.post to be empty strings. Configure it to return one maximum length snippet. That should return the entire matching fields, though I haven’t tested it.
wunder Walter Underwood [email protected] http://observer.wunderwood.org/ (my blog) > On Jul 12, 2016, at 1:24 AM, Prasanna Josium <[email protected]> > wrote: > > Hi all, > > My requirement is in line with > https://issues.apache.org/jira/browse/SOLR-3955 > I'm working on a project that has very low network bandwidth for the clients. > I'm using Solr 4.10 > > The problem: > I have ~ 1M documents with multiple fields(~50), many of them are indexed, > stored and some of them are multivalued. > Queries are searched across all these fields and often, only a few of the > fields have matching terms in them. > > When I search for a term="Hobbit", I want to return documents only with the > matching fields where "Hobbit" is found. > All other un matched fields in the result doc shall be dropped from the > result set. > > Naïve solution: > The obvious solution I could think of was to implement a custom search > component based on the "Highlighter" component to filter out unwanted fields. > But I'm not sure of the performance penalty for large number of fields or > many multi valued fields / document. > > Question: > Is there a better way to solve this problem? Apparently I'm not the first > person facing such an issue. > > Thanks > Cheers > Prasanna > > > >
