@Test public void testLongTruncatedLine() throws ParseException { StringBuilder sb = new StringBuilder(); sb.append("search_for_me"); while (sb.length() <= 100) { sb.append(" more words"); } sb.append("should not be found"); Reader in = new StringReader(sb.toString()); StringWriter out = new StringWriter(); QueryBuilder qb = new QueryBuilder().setFreetext("search_for_me"); Context c = new Context(qb.build(), qb); boolean match = c.getContext(in, out, "", "", "", null, true, qb.isDefSearch(), null); assertTrue("No match found", match); String s = out.toString(); assertTrue("Match not listed", s.contains("<b>search_for_me</b>")); assertFalse("Line not truncated", s.contains("should not be found")); assertTrue("Ellipsis not found", s.contains("&hellip;")); }
public boolean getContext(Reader in, Writer out, String urlPrefix, String morePrefix, String path, Definitions tags, boolean limit, boolean isDefSearch, List<Hit> hits) { return getContext(in, out, urlPrefix, morePrefix, path, tags, limit, isDefSearch, hits, null); }
Context { public boolean getContext(Reader in, Writer out, String urlPrefix, String morePrefix, String path, Definitions tags, boolean limit, boolean isDefSearch, List<Hit> hits) { return getContext(in, out, urlPrefix, morePrefix, path, tags, limit, isDefSearch, hits, null); } }
Context { public boolean getContext(Reader in, Writer out, String urlPrefix, String morePrefix, String path, Definitions tags, boolean limit, boolean isDefSearch, List<Hit> hits) { return getContext(in, out, urlPrefix, morePrefix, path, tags, limit, isDefSearch, hits, null); } Context(Query query, QueryBuilder qbuilder); }
Context { public boolean getContext(Reader in, Writer out, String urlPrefix, String morePrefix, String path, Definitions tags, boolean limit, boolean isDefSearch, List<Hit> hits) { return getContext(in, out, urlPrefix, morePrefix, path, tags, limit, isDefSearch, hits, null); } Context(Query query, QueryBuilder qbuilder); void toggleAlt(); boolean isEmpty(); boolean getContext2(RuntimeEnvironment env, IndexSearcher searcher,
        int docId, Appendable dest, String urlPrefix, String morePrefix,
        boolean limit, int tabSize); boolean getContext(Reader in, Writer out, String urlPrefix,
        String morePrefix, String path, Definitions tags,
        boolean limit, boolean isDefSearch, List<Hit> hits); boolean getContext(Reader in, Writer out, String urlPrefix,
            String morePrefix, String path, Definitions tags,
            boolean limit, boolean isDefSearch, List<Hit> hits, Scopes scopes); }
Context { public boolean getContext(Reader in, Writer out, String urlPrefix, String morePrefix, String path, Definitions tags, boolean limit, boolean isDefSearch, List<Hit> hits) { return getContext(in, out, urlPrefix, morePrefix, path, tags, limit, isDefSearch, hits, null); } Context(Query query, QueryBuilder qbuilder); void toggleAlt(); boolean isEmpty(); boolean getContext2(RuntimeEnvironment env, IndexSearcher searcher,
        int docId, Appendable dest, String urlPrefix, String morePrefix,
        boolean limit, int tabSize); boolean getContext(Reader in, Writer out, String urlPrefix,
        String morePrefix, String path, Definitions tags,
        boolean limit, boolean isDefSearch, List<Hit> hits); boolean getContext(Reader in, Writer out, String urlPrefix,
            String morePrefix, String path, Definitions tags,
            boolean limit, boolean isDefSearch, List<Hit> hits, Scopes scopes);  }