Package com.gentics.cr.lucene.search.highlight

Examples of com.gentics.cr.lucene.search.highlight.ContentHighlighter


    if (highlighters != null) {
      UseCase ucProcessSearchHighlight = MonitorFactory.startUseCase("LuceneRequestProcessor." + "getObjects("
          + name + ")#processSearch.Highlight");
      long s2 = System.currentTimeMillis();
      for (Entry<String, ContentHighlighter> contentHighlighter : highlighters.entrySet()) {
        ContentHighlighter highligther = contentHighlighter.getValue();
        String att = contentHighlighter.getKey();
        //IF crBean matches the highlighters rule => highlight
        if (highligther.match(crBean)) {
          String ret = null;
          if (highligther instanceof AdvancedContentHighlighter) {
            AdvancedContentHighlighter advancedHighlighter = (AdvancedContentHighlighter) highligther;
            int documentId = Integer.parseInt(doc.get("id"));

            ret = advancedHighlighter.highlight(parsedQuery, reader, documentId, att);

          } else {
            ret = highligther.highlight((String) crBean.get(att), parsedQuery);
          }
          if (ret != null && !"".equals(ret)) {
            crBean.set(att, ret);
          }
        }
View Full Code Here


    assertTrue(ret != null && !"".equals(ret));
  }

  public void testPhraseBolder2() throws Exception {
    System.out.println("PHRASE2");
    ContentHighlighter h = new PhraseBolder(new GenericConfiguration());
    CRResolvableBean crBean = new CRResolvableBean();
    crBean.set("binarycontent", "this is a test (AHSt)");
    String ret = h.highlight((String) crBean.get("binarycontent"), query);
    System.out.println(ret);

    assertTrue(ret != null && !"".equals(ret));
  }
View Full Code Here

TOP

Related Classes of com.gentics.cr.lucene.search.highlight.ContentHighlighter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.