use of org.opengrok.indexer.search.Summarizer in project OpenGrok by OpenGrok.
the class SearchHelper method prepareSummary.
/**
* Prepare the fields to support printing a full blown summary. Does nothing
* if {@link #redirect} or {@link #errorMsg} have a none-{@code null} value.
*
* <p>
* Parameters which should be populated/set at this time: <ul>
* <li>{@link #query}</li> <li>{@link #builder}</li> </ul> Populates/sets:
* Otherwise the following fields are set (includes {@code null}): <ul>
* <li>{@link #sourceContext}</li> <li>{@link #summarizer}</li>
* <li>{@link #historyContext}</li> </ul>
*
* @return this instance.
*/
public SearchHelper prepareSummary() {
if (redirect != null || errorMsg != null) {
return this;
}
try {
sourceContext = new Context(query, builder);
summarizer = new Summarizer(query, new CompatibleAnalyser());
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Summarizer: {0}", e.getMessage());
}
try {
historyContext = new HistoryContext(query);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "HistoryContext: {0}", e.getMessage());
}
return this;
}
Aggregations