Package org.apache.lucene.search

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


      String aDocs[] = new String[nHitCount]
      float aScores[] = null;
      aScores = new float[nHitCount];
      for( int iHit = 0 ; iHit < nHitCount ; iHit++ )
      {
        Document aDoc = aHits.doc( iHit );
        String aPath = aDoc.get( "path" );
        aDocs[iHit] = ( aPath != null ) ? aPath : "";
        aScores[iHit] = aHits.score( iHit );
      }
      aScoreOutArray[0] = aScores;
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

                        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

    if(printResults)
    {
      System.out.println("========="+qType+"============");
      for(int i=0;i<Math.min(numDocs,h.length());i++)
      {
        org.apache.lucene.document.Document ldoc=h.doc(i);
        System.out.println("["+ldoc.get("date")+"]"+ldoc.get("contents"));
      }
      System.out.println();
    }
  }
View Full Code Here

            final ProvidedService config) throws IOException, ParseException {
        DateTime updated = null;
        Hits feedHits = storageFeedQuery(feedId);
        if (feedHits.length() == 0)
            return null;
        BaseFeed retVal = buildFeedFromLuceneDocument(feedHits.doc(0), config);

        List<BaseEntry> returnList = new ArrayList<BaseEntry>(resultCount);
        List<StorageEntryWrapper> bufferedWrapperList = this.buffer
                .getSortedEntries(feedId);
        int alreadyAdded = 0;
View Full Code Here

        Hits hits = storageFeedQuery(feedId, this.timeStampSort);
        if (hits.length() > 0) {

            for (; (offset < hits.length()) && (alreadyAdded < resultCount); offset++, alreadyAdded++) {
                Document doc = hits.doc(offset);
                BaseEntry entry = buildEntryFromLuceneDocument(doc, config);
                returnList.add(entry);
            }
            if (updated == null) {
                try {
View Full Code Here

                BaseEntry entry = buildEntryFromLuceneDocument(doc, config);
                returnList.add(entry);
            }
            if (updated == null) {
                try {
                    long updatedTimeStamp = Long.parseLong(hits.doc(0).get(
                            StorageEntryWrapper.FIELD_TIMESTAMP));
                    updated = new DateTime(updatedTimeStamp);
                } catch (Exception e) {
                    LOG.warn("could not create DateTime -- " + e.getMessage(),
                            e);
View Full Code Here

                            StorageEntryWrapper.FIELD_TIMESTAMP));
                    updated = new DateTime(updatedTimeStamp);
                } catch (Exception e) {
                    LOG.warn("could not create DateTime -- " + e.getMessage(),
                            e);
                    updated = buildEntryFromLuceneDocument(hits.doc(0), config)
                            .getUpdated();
                }
            }
        }
        retVal.setUpdated(updated);
View Full Code Here

        if (wrapper == null) {
            Hits hits = storageQuery(entryId);
            if (hits.length() <= 0)
                return null;
            Document doc = hits.doc(0);

            return buildEntryFromLuceneDocument(doc, config);
        }
        /*
         * ServerBaseEntry enables the dynamic element of the entry like the
View Full Code Here

        TermQuery query = new TermQuery(new Term(
                StorageAccountWrapper.FIELD_ACCOUNTNAME, username));
        Hits h = this.searcher.search(query);
        if (h.length() == 0)
            return null;
        return StorageAccountWrapper.buildEntity(h.doc(0));
    }

    /**
     * Closes all resources used in the {@link StorageQuery}. The instance can
     * not be reused after invoking this method.
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.