Package org.apache.lucene.search

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


    int numResults = hits.length();
    //System.out.println(numResults + " found............................");
    int result_count = Math.min(numResults, MAX_RESULT_COUNT);
    List results = new ArrayList(result_count);
    for(int i=0;i<result_count;i++){
      Document doc = (Document)hits.doc(i);
      //ӳ���ĵ����Ե�Java������
      Object result = params.getSearchObject().newInstance();
      Enumeration fields = doc.fields();
      while(fields.hasMoreElements()){
        Field field = (Field)fields.nextElement();
View Full Code Here


            } else if( nntpRequest.getCommand().equalsIgnoreCase("xover") ) {
                nntpResponse.sendResponse( 224, "Header follows" );
                NewsGroup group = forum.getNewsgroup( nntpRequest.getCurrentNewsgroup() );
                Hits hits = forum.getOverview( group );
                for( int i = 0; i < hits.length(); i++ ) {
                    Document doc = hits.doc( i );
                    NntpOutputStream stream = nntpResponse.getOutputStream();
                    stream.print( doc.getField("article." + group.getName() + ".article-number").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.subject").stringValue() );
                    stream.print( "\t" );
View Full Code Here

      Hits oHitSet = oSearch.search(oQry);
      int iHitCount = oHitSet.length();
      if (iHitCount>0) {
        aRetArr = new BugRecord[iHitCount];
        for (int h=0; h<iHitCount; h++) {
          oDoc = oHitSet.doc(h);
          aRetArr[h] = new BugRecord(oHitSet.score(h),
                   Integer.parseInt(oDoc.get("number")),
                       oDoc.get("guid"), oDoc.get("container"), oDoc.get("title"),
                       oDoc.get("author"), oDoc.get("created"), oDoc.get("type"),
                       oDoc.get("status"), oDoc.get("priority"),
View Full Code Here

      Hits oHitSet = oSearch.search(oQrx);
      int iHitCount = oHitSet.length();
      if (iHitCount>0) {
        aRetArr = new NewsMessageRecord[iHitCount];
        for (int h=0; h<iHitCount; h++) {
          oDoc = oHitSet.doc(h);
          try {
            aRetArr[h] = new NewsMessageRecord(oHitSet.score(h), oDoc.get("workarea"),
                         oDoc.get("guid"), oDoc.get("container"), oDoc.get("title"),
                         oDoc.get("author"), DateTools.stringToDate(oDoc.get("created")), oDoc.get("abstract"));
          } catch (java.text.ParseException neverthrown) {
View Full Code Here

      Hits hits = searcher.search(parser.parse(query));
      List<BookmarkDoc> bmDocs = new ArrayList<BookmarkDoc>();
      if (offset >= 0 && offset < hits.length()) {
        if (count > 0) {         
          for (int i = offset; i < hits.length() && bmDocs.size() < count; i++) {
            BookmarkDoc doc = createBookmarkDoc(hits.doc(i));
            if (doc != null) {
              bmDocs.add(doc);
            }
          }
        }
View Full Code Here

      Hits hits = searcher.search(boolQuery);
      List<BookmarkDoc> bmDocs = new ArrayList<BookmarkDoc>();
      if (offset >= 0 && offset < hits.length()) {
        if (count > 0) {         
          for (int i = offset; i < hits.length() && bmDocs.size() < count; i++) {
            BookmarkDoc doc = createBookmarkDoc(hits.doc(i));
            if (doc != null) {
              bmDocs.add(doc);
            }
          }
        }
View Full Code Here

        if(idxReader != null && field != null){
          maxNumCandidate = maxSuggestionSize * 10;
        }
        PriorityQueue<SuggestWord> suggestQueue = new PriorityQueue<SuggestWord>(maxNumCandidate);
        for(int i = 0; i < hits.length() && i < maxNumCandidate; i++){
          String sugWord = hits.doc(i).get("t");
          // check if the 'sugWord' matches at least one doc in the
          // source index database (idxReader)
          if(idxReader != null && field != null){
            int freq = idxReader.docFreq(new Term(field,sugWord));
            if(freq > 0){
View Full Code Here

     for (int j = 0; j < ranks.length; j++) if (ranks[j] == i) foundHit = true;
     if (!foundHit) continue LOOP;
    
     retv.append("Document: " + i + Constants.NEWLINE);
     explanation = is.explain(query, hits.id(i))
     Document doc = hits.doc(i);
     String key = doc.get("key");
     DatabaseEntry data = new DatabaseEntry();
     if (!dbt.fetch(key, data)) continue LOOP;

     //*-- extract the text
View Full Code Here

    Hits hits = searcher.search(query);
    nrOfHits = hits.length();
    logger.info("Query returned " + nrOfHits + " hits.");
    List<ItemResult> results = new ArrayList<ItemResult>();
    for (int i = 0; i < hits.length() && i < maxResults; i++) {
      Document doc = hits.doc(i);
      long channelId = Long.parseLong(doc.get(ItemFieldConstants.CHANNEL_ID));
      ChannelIF channel = channels.getById(channelId);
      if (channel == null) {
        throw new UnretrievableException("channel " + channelId);
      }
View Full Code Here

      int iHitCount = oHitSet.length();
      if (DebugFile.trace) DebugFile.writeln("hit count is "+String.valueOf(iHitCount));
      if (iHitCount>0) {
        aRetArr = new MailRecord[iHitCount];
        for (int h=0; h<iHitCount; h++) {
          Document oDoc = oHitSet.doc(h);
          if (DebugFile.trace) DebugFile.writeln("found "+oDoc.get("guid")+" "+oDoc.get("title")+" created by "+" "+oDoc.get("author")+" at date "+oDoc.get("created"));
          String[] aAbstract = Gadgets.split(oDoc.get("abstract"), '¨');
          aRetArr[h] = new MailRecord(aAbstract[0], aAbstract[1], aAbstract[2],
                                      aAbstract[3], aAbstract[4], aAbstract[5],
                                      oDoc.get("container"));
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.