Search in sources :

Example 1 with Summarizer

use of org.opensolaris.opengrok.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.getQueries());
        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;
}
Also used : HistoryContext(org.opensolaris.opengrok.search.context.HistoryContext) Context(org.opensolaris.opengrok.search.context.Context) CompatibleAnalyser(org.opensolaris.opengrok.analysis.CompatibleAnalyser) HistoryContext(org.opensolaris.opengrok.search.context.HistoryContext) Summarizer(org.opensolaris.opengrok.search.Summarizer) ParseException(org.apache.lucene.queryparser.classic.ParseException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParseException (org.apache.lucene.queryparser.classic.ParseException)1 CompatibleAnalyser (org.opensolaris.opengrok.analysis.CompatibleAnalyser)1 Summarizer (org.opensolaris.opengrok.search.Summarizer)1 Context (org.opensolaris.opengrok.search.context.Context)1 HistoryContext (org.opensolaris.opengrok.search.context.HistoryContext)1