You could do this with a custom Collector which, for every hit visits all child scorers asking each one whether it matched the current hit. Your collector would have to somehow store this information away so that once the search is done and you pull the top N hits, you know which fields those hits had matched.
Mike McCandless http://blog.mikemccandless.com On Mon, Mar 30, 2015 at 1:07 PM, Fielder, Todd Patrick <tpfi...@sandia.gov> wrote: > Hello, > > I'm new to Lucene and am looking for advice. I'm wanting to search the > entire DB (or almost the entire DB) for a keyword. The users also want to > know which field the string occurred in. > > I can think of two ways to do this, but neither are ideal and I'm looking for > suggestions: > > 1) Search the entire DB and add all the text I want to search to a > single string and store that string. Then create a query against that > string...Using this approach, is there any way to know which field the match > it is in? Context highlighting is not sufficient, they want the DB column of > the match...we are using EclipseLink/JPA (but are considering switching to > Hibernate) > > 2) Query every single field checking for results with each query (this > seems slow (and tedious!)) > > Any help is greatly appreciated > > -Todd --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org