Package org.apache.lucene.search

Examples of org.apache.lucene.search.Searcher.search()


        if(!results.contains(path))
          results.add(path);
      }
      if(content){
        query = QueryParser.parse(item, "Contents", analyzer);
        hits = searcher.search(query);
        for (int i = 0; i < hits.length() && i < QueryManager.resultSize; i++) {
          Document doc = hits.doc(i);
          String path = doc.get("Path");
          if (!results.contains(path))
            results.add(path);
View Full Code Here


          String path = doc.get("Path");
          if (!results.contains(path))
            results.add(path);
        }
        query = QueryParser.parse(item, "ExtendedInfosContent", analyzer);
        hits = searcher.search(query);
        for (int i = 0; i < hits.length() && i < QueryManager.resultSize; i++) {
          Document doc = hits.doc(i);
          String path = doc.get("Path");
          if (!results.contains(path))
            results.add(path);
View Full Code Here

          if (!results.contains(path))
            results.add(path);
        }
      }
      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);
View Full Code Here

      ArrayList results = new ArrayList();
      IndexReader reader = IndexReader.open(remoteStoreIndex);
      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);
View Full Code Here

                        log.debug("Query Class:" + query.getClass().getName());
                        log.debug("Searching for: " + query.toString("contents"));
                        log.debug("Searching for: " + query.toString());

                        //Do the Search
                        hits = searcher.search(query);

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

                        //Loop and display the results
                        for (int counter = 0; counter < hits.length(); counter++)
View Full Code Here

            {
                log.info("Lucene not yet ready; indexing not started",ex);
                return null;
            }

            Hits hits = searcher.search(luceneQuery);

            list = new ArrayList<SearchResult>(hits.length());
            for ( int curr = 0; curr < hits.length(); curr++ )
            {
                Document doc = hits.doc(curr);
View Full Code Here

      readers=_idxReaderFactory.getIndexReaders();
      multiReader=new MultiReader(readers.toArray(new IndexReader[readers.size()]), false);
      searcher=new IndexSearcher(multiReader);
     
      long start=System.currentTimeMillis();
      TopDocs docs=searcher.search(q, null, 10);
      long end=System.currentTimeMillis();
     
      result.setTime(end-start);
      result.setTotalDocs(multiReader.numDocs());
      result.setTotalHits(docs.totalHits);
View Full Code Here

          hourglass.returnIndexReaders(readers);
        }
        readers = hourglass.getIndexReaders();
        reader = new MultiReader(readers.toArray(new IndexReader[0]),false);
        searcher = new IndexSearcher(reader);
        TopDocs hitsall = searcher.search(new MatchAllDocsQuery(), 10);
        numDoc = hitsall.totalHits;
        if (numDoc!=oldNum)System.out.println("numDoc: " + numDoc);
        oldNum = numDoc;
        Thread.sleep(30);
      }
View Full Code Here

        if (numDoc!=oldNum)System.out.println("numDoc: " + numDoc);
        oldNum = numDoc;
        Thread.sleep(30);
      }
      accumulatedTime += (System.currentTimeMillis() - flushtime);
      TopDocs hits = searcher.search(new TermQuery(new Term("contents",""+i)), 10);
      TopDocs hitsall = searcher.search(new MatchAllDocsQuery(), 10);
      try
      {
        assertEquals("one hit for " + i, 1, hits.totalHits);
        assertEquals("MatchAllDocsHit ", i+1, hitsall.totalHits);
View Full Code Here

        oldNum = numDoc;
        Thread.sleep(30);
      }
      accumulatedTime += (System.currentTimeMillis() - flushtime);
      TopDocs hits = searcher.search(new TermQuery(new Term("contents",""+i)), 10);
      TopDocs hitsall = searcher.search(new MatchAllDocsQuery(), 10);
      try
      {
        assertEquals("one hit for " + i, 1, hits.totalHits);
        assertEquals("MatchAllDocsHit ", i+1, hitsall.totalHits);
      } finally
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.