Package org.apache.lucene.search

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


        }
      }
      query = QueryParser.parse(item,"PartialFileName",analyzer);
      hits = searcher.search(query);
      for(int i = 0; i < hits.length() && i < QueryManager.resultSize; i++){
        Document doc = hits.doc(i);
        StringHash hash = new StringHash(doc.get("PartialFileHash"));
        if(!results.contains(hash))
          results.add(hash);
      }
      reader.close();
View Full Code Here


      Searcher searcher = new IndexSearcher(reader);
      Analyzer analyzer = new StandardAnalyzer();
      Query query = QueryParser.parse(item,"RemoteFileContent",analyzer);
      Hits hits = searcher.search(query);
      for(int i = 0; i < hits.length() && (localSearch || i < QueryManager.resultSize); i++){
        Document doc = hits.doc(i);
        String hash = doc.get("RemoteFileHash");
        if(!results.contains(hash))
          results.add(hash);
      }
      reader.close();
View Full Code Here

                for (int i = 0;
                        (i < hits.length()) && (listDocs.size() < maxDocNo);
                        i++) {
                    try {
                        //get the document and add it to the list
                        Document doc = hits.doc(i);
                        logger.debug("Doc path" +
                            doc.get(DocumStruct.FIELD_PATH));
                        logger.debug("CategName " +
                            doc.get(DocumStruct.FIELD_CATEGORY_NAME));
                        logger.debug("CalcScore " +
View Full Code Here

                        log.debug("Number of Results:" + hits.length());

                        //Loop and display the results
                        for (int counter = 0; counter < hits.length(); counter++)
                         {
                                doc = hits.doc(counter);
                                log.debug("Rank:" + hits.score(counter) + " Info:" + doc.toString());
                        }

                        searcher.close();
                       
View Full Code Here

            Hits hits = searcher.search(luceneQuery);

            list = new ArrayList<SearchResult>(hits.length());
            for ( int curr = 0; curr < hits.length(); curr++ )
            {
                Document doc = hits.doc(curr);
                String pageName = doc.get(LUCENE_ID);
                WikiPage page = m_engine.getPage(pageName, WikiPageProvider.LATEST_VERSION);

                if(page != null)
                {
View Full Code Here

                                if (useSize.isSelected()) {
                                    currentDocument = (Document) sizeList[0].get(i);
                                    currentScore = ((Float) sizeList[1].get(i)).floatValue();
                                }
                                else {
                                    currentDocument = hits.doc(i);
                                    currentScore = hits.score(i);
                                }

                                // title
                                String currentTitle = Utils.convertTextToHTML(currentDocument.get(Index.FIELD_TITLE));
View Full Code Here

        for (int counter = 0; counter < hitCount; counter++)
        {           
            ParsedObject result = new BaseParsedObject();
            try
            {
                doc = hits.doc(counter);
                addFieldsToParsedObject(doc, result);
               
                result.setScore(hits.score(counter));
                Field type = doc.getField(ParsedObject.FIELDNAME_TYPE);
                if(type != null)
View Full Code Here

        for (int counter = 0; counter < hitCount; counter++)
        {           
            ParsedObject result = new BaseParsedObject();
            try
            {
                doc = hits.doc(counter);
                result.setScore(hits.score(counter));
                result.setType(doc.getField(ParsedObject.FIELDNAME_TYPE).stringValue());
                result.setKey(doc.getField(ParsedObject.FIELDNAME_KEY).stringValue());
                result.setDescription(doc.getField(ParsedObject.FIELDNAME_DESCRIPTION).stringValue());
                result.setTitle(doc.getField(ParsedObject.FIELDNAME_TITLE).stringValue());
View Full Code Here

      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

          if (raw) {                              // output raw format
            System.out.println("doc="+hits.id(i)+" score="+hits.score(i));
            continue;
          }

          Document doc = hits.doc(i);
          String path = doc.get("path");
          if (path != null) {
            System.out.println((i+1) + ". " + path);
            String title = doc.get("title");
            if (title != null) {
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.