Package org.apache.lucene.search

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


      BoldFormatter formatter = new BoldFormatter();
      Highlighter highlighter =new Highlighter(formatter,new QueryScorer(query));
      highlighter.setTextFragmenter(new SimpleFragmenter(50));
      for (int i = 0; i < hits.length(); i++)
      {
        String text = hits.doc(i).get(FIELD_NAME);
        int maxNumFragmentsRequired = 5;
        String fragmentSeparator = "...";
        TermPositionVector tpv = (TermPositionVector)reader.getTermFreqVector(hits.id(i),FIELD_NAME);
        TokenStream tokenStream=TokenSources.getTokenStream(tpv);
        /*
 
View Full Code Here


                        break;
                    }

                    try
                    {
                        Document doc = hits.doc( offset + i );
                        LuceneRepositoryContentRecord record = converter.convert( doc );
                        results.addHit( record );
                    }
                    catch ( java.text.ParseException e )
                    {
View Full Code Here

    Term identifierTerm=identifier.getIdentifier();
    Document updatedDocument=null;
    try {
      Hits hits=searcher.search(new TermQuery(identifierTerm));
      checkHitsForUpdate(hits);
      updatedDocument=documentModifier.updateDocument(hits.doc(0));
    } catch(IOException ex) {
      throw new LuceneIndexAccessException("Error during updating a document.",ex);
    } finally {
      SearcherFactoryUtils.releaseSearcher(searcher);
      IndexReaderFactoryUtils.releaseIndexReader(indexFactory,reader);
View Full Code Here

        // query, new StandardAnalyzer());

        int maxNumFragmentsRequired = 3;

        for (int i = 0; i < hits.length(); i++) {
          String text = hits.doc(i).get(FIELD_NAME);
          TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
          Highlighter highlighter = getHighlighter(query, FIELD_NAME, tokenStream, HighlighterTest.this, false);

          highlighter.setTextFragmenter(new SimpleFragmenter(40));
View Full Code Here

                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 {
View Full Code Here

            Hits aHits = searcher.search(aQuery);
            int nHitCount = aHits.length();

            String aDocs[] = new String[nHitCount];
            for (int iHit = 0; iHit < nHitCount; iHit++) {
                Document aDoc = aHits.doc(iHit);
                String aPath = aDoc.get("path");
                aDocs[iHit] = (aPath != null) ? aPath : "";
            }

            reader.close();
View Full Code Here

                    SortField.STRING, true));
            Hits hits = searcher.search(booleanQuery, sort);
            if (hits.length() > 0) {
                products = new Vector(hits.length());
                for (int i = 0; i < hits.length(); i++) {
                    Document productDoc = hits.doc(i);
                    products.add(productDoc.get("reference_data_store"));
                }
            } else {
                LOG.log(Level.WARNING, "Query: [" + query1
                        + "] for Product Type: [" + productTypeId
View Full Code Here

                        + workflowInstId + "] is not being "
                        + "managed by this " + "workflow engine, or "
                        + "is not unique in the catalog!");
                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

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.