Package org.jayasoft.woj.common.model.search

Examples of org.jayasoft.woj.common.model.search.Hit


        int i;
        int countModuleHit = 0;
        for (i = 0; i < hits.length() && results.size() < RESULTS_PER_PAGE; i++) {
          Document doc = hits.doc(i);
          String key = doc.get("visibility")+"/"+doc.get("organisation")+"/"+doc.get("module")+"/"+doc.get("fqcn");
          Hit hit = (Hit) h.get(key);
          if (hit == null) {
            hit = new Hit(doc.get("visibility"), doc.get("organisation"), doc.get("module"), doc.get("fqcn"), hits.score(i));
            h.put(key, hit);
            if (countModuleHit >= startIndex) {
              results.add(hit);
            }
            countModuleHit++;
          }
          // not stricly necessary, but sometimes lucene doesn't find the revisions in the second step...
          hit.addRevision(doc.get("path"), doc.get("revision"));
        }
        Long nextResults =  i == hits.length()?null:new Long(startIndex+RESULTS_PER_PAGE);
        Long previousResults = startIndex == 0?null:new Long(startIndex-RESULTS_PER_PAGE);
       
        // then we fill in revisions
        for (Iterator iter = results.iterator(); iter.hasNext();) {
      Hit hit = (Hit) iter.next();
      hits = is.search(query, new QueryFilter(queryParser.parse(
          "organisation:"+hit.getOrganisation()
          +" AND module:"+hit.getModule()
          +" AND fqcn:"+hit.getClassname()
      )));
      for (i = 0; i < hits.length(); i++) {
              Document doc = hits.doc(i);
              hit.addRevision(doc.get("path"), doc.get("revision"));
      }
    }
       
        is.close();
View Full Code Here


      }

      private String[] getClasses(SearchResult searchResult, String org, String name, String rev) {
        Set result = new TreeSet();
        for (Iterator iter = searchResult.getHits().iterator(); iter.hasNext();) {
          Hit hit = (Hit) iter.next();
          if (org.equals(hit.getOrganisation()) && name.equals(hit.getModule())) {
            Collection revisions = hit.getRevisions();
            for (Iterator iterator = revisions.iterator(); iterator.hasNext();) {
              HitRevision s = (HitRevision) iterator.next();
              if (rev.equals(s.getRevision())) {
                result.add(s.getPath().substring(s.getPath().indexOf("sources") + "sources".length() + 1));
              }
View Full Code Here

      }

      private String[] getRevision(SearchResult searchResult, String org, String name) {
        Set result = new TreeSet();
        for (Iterator iter = searchResult.getHits().iterator(); iter.hasNext();) {
          Hit hit = (Hit) iter.next();
          if (org.equals(hit.getOrganisation()) && name.equals(hit.getModule())) {
            Collection revisions = hit.getRevisions();
            for (Iterator iterator = revisions.iterator(); iterator.hasNext();) {
              HitRevision s = (HitRevision) iterator.next();
              result.add(s.getRevision());
            }
          }
View Full Code Here

      }

      private String[] getNames(SearchResult searchResult, String org) {
        Set orgs = new TreeSet();
        for (Iterator iter = searchResult.getHits().iterator(); iter.hasNext();) {
          Hit hit = (Hit) iter.next();
          if (org.equals(hit.getOrganisation())) {
            orgs.add(hit.getModule());
          }
        }
        String[] orgsArray = (String[]) orgs.toArray(new String[orgs.size()]);
        Arrays.sort(orgsArray);
        return orgsArray;
View Full Code Here

      }

      private String[] getOrganisations(SearchResult searchResult) {
        Set orgs = new TreeSet();
        for (Iterator iter = searchResult.getHits().iterator(); iter.hasNext();) {
          Hit hit = (Hit) iter.next();
          orgs.add(hit.getOrganisation());
        }
        String[] orgsArray = (String[]) orgs.toArray(new String[orgs.size()]);
        Arrays.sort(orgsArray);
        return orgsArray;
      }
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.model.search.Hit

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.