Package org.apache.lucene.search

Examples of org.apache.lucene.search.Hits.doc()


      assertEquals(expected[x], distances.size());
      assertEquals(expected[x], results);
     
      for(int i =0 ; i < results; i++){
        Document d = hits.doc(i);
       
        String name = d.get("name");
        double rsLat = NumericUtils.prefixCodedToDouble(d.get(latField));
        double rsLng = NumericUtils.prefixCodedToDouble(d.get(lngField));
        Double geo_distance = distances.get(hits.id(i));
View Full Code Here


        searcher = new IndexSearcher(blog.getSearchIndexDirectory());
        Query query = QueryParser.parse(queryString, "blogEntry", getAnalyzer());
        Hits hits = searcher.search(query);

        for (int i = 0; i < hits.length(); i++) {
          Document doc = hits.doc(i);
          SearchHit result = new SearchHit(
              blog,
              doc.get("id"),
              doc.get("permalink"),
              doc.get("title"),
View Full Code Here

        Hits hits = searcher.search(query);
  assertEquals(1, hits.length());

        try
        {
            doAssert(hits.doc(0), true);
        }
        catch (Exception e)
        {
            e.printStackTrace(System.err);
            System.err.print("\n");
View Full Code Here

  final int HITS_PER_PAGE = 10;
  for (int start = 0; start < hits.length(); start += HITS_PER_PAGE) {
    int end = Math.min(hits.length(), start + HITS_PER_PAGE);
    for (int i = start; i < end; i++) {
      Document doc = hits.doc(i);
      String path = doc.get("path");
      if (path != null) {
              System.out.println(i + ". " + path);
      } else {
              String url = doc.get("url");
View Full Code Here

                        + workflowInstId + "] is not being "
                        + "managed by this " + "workflow engine, or "
                        + "is not unique in the catalog: num hits: ["+hits.length()+"]");
                return null;
            } else {
                Document instDoc = hits.doc(0);
                wInst = toWorkflowInstance(instDoc);
            }

        } catch (IOException e) {
            LOG.log(Level.WARNING,
View Full Code Here

            if (hits.length() > 0) {
                wInsts = new Vector(hits.length());

                for (int i = 0; i < hits.length(); i++) {
                    Document doc = hits.doc(i);
                    WorkflowInstance wInst = toWorkflowInstance(doc);
                    wInsts.add(wInst);
                }
            }
View Full Code Here

            if (hits.length() > 0) {
                wInsts = new Vector(hits.length());

                for (int i = 0; i < hits.length(); i++) {
                    Document doc = hits.doc(i);
                    WorkflowInstance wInst = toWorkflowInstance(doc);
                    wInsts.add(wInst);
                }
            }
View Full Code Here

                instIds = new Vector(pageSize);

                for (int i = startNum; i < Math.min(hits.length(),
                        (startNum + pageSize)); i++) {
                    Document instDoc = hits.doc(i);
                    WorkflowInstance inst = toWorkflowInstance(instDoc);
                    instIds.add(inst.getId());

                }
            } else {
View Full Code Here

              throw new CatalogException("Product: [" + productId + "] NOT found in the catalog!");
            } else if (hits.length() > 1) {
                throw new CatalogException("Product: [" + productId+ "] is not unique in the catalog!");
            }

            Document productDoc = hits.doc(0);
            CompleteProduct prod = toCompleteProduct(productDoc, getRefs,
                    getMet);
            return prod;
        } catch (IOException e) {
            LOG.log(Level.WARNING,
View Full Code Here

            Hits hits = searcher.search(query, sort);

            // should be > 0 hits
            if (hits.length() > 0) {
                // just get the first hit back
                Document productDoc = hits.doc(0);
                CompleteProduct prod = toCompleteProduct(productDoc, getRefs,
                        false);
                return prod.getProduct();
            } else {
                LOG.log(Level.FINEST, "Request for product by name: ["
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.