Package proj.zoie.admin.client.search

Examples of proj.zoie.admin.client.search.SearchHit


      ScoreDoc[] scoreDocs=docs.scoreDocs;
      ArrayList<SearchHit> hitList=new ArrayList<SearchHit>(scoreDocs.length);
      for (ScoreDoc scoreDoc : scoreDocs)
      {
        SearchHit hit=new SearchHit();
        hit.setScore(scoreDoc.score);
        int docid=scoreDoc.doc;
       
        Document doc=multiReader.document(docid);
        String content=doc.get("content");
       
        Scorer qs=new QueryScorer(q);
       
        SimpleHTMLFormatter formatter=new SimpleHTMLFormatter("<span class=\"hl\">","</span>");
        Highlighter hl=new Highlighter(formatter,qs);
        String[] fragments=hl.getBestFragments(analyzer, "content",content, 1);
       
        Map<String,String[]> fields=convert(doc);
        fields.put("fragment",fragments);
        hit.setFields(fields);
        hitList.add(hit);
      }
     
      result.setHits(hitList.toArray(new SearchHit[hitList.size()]));
      return result;
View Full Code Here


    SearchResult res = new SearchResult();
    proj.zoie.service.api.SearchHit[] oldHits = result.getHits();
    SearchHit[] hits = new SearchHit[result.getHits().length];
    for(int i=0; i < oldHits.length; i++)
    {
      hits[i] = new SearchHit();
      hits[i].setFields(oldHits[i].getFields());
      hits[i].setScore(oldHits[i].getScore());
    }
    res.setHits(hits);
    res.setTime(result.getTime());
View Full Code Here

TOP

Related Classes of proj.zoie.admin.client.search.SearchHit

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.