Package org.apache.lucene.search

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


        try
        {
            Searcher searcher = new IndexSearcher(indexPath);

            Query query = QueryParser.parse(searchedText, TextContentIndexer.CONTENT_TEXT, analyzer);
            Hits hits = searcher.search (query);
            int noOfHits = hits.length();

            for (int i = 0; i < noOfHits; i++)
            {
                Document doc = hits.doc(i);
View Full Code Here


        Searcher searcher = new IndexSearcher (indexDb);
        Analyzer analyzer = new StandardAnalyzer();
       
        Query query = QueryParser.parse(stringToFind, "contents", analyzer);
       
        Hits hits = searcher.search(query);
       
        int noOfHits = hits.length();
        for (int i = 0; i < noOfHits; i++)
        {
            Document doc = hits.doc(i);
View Full Code Here

    private void assertRecordCount( RepositoryContentIndex index, int expectedCount )
        throws Exception
    {
        Query query = new MatchAllDocsQuery();
        Searcher searcher = (Searcher) index.getSearchable();
        Hits hits = searcher.search( query );
        assertEquals( "Expected Record Count for " + index.getId(), expectedCount, hits.length() );
    }

    private CrossRepositorySearch lookupCrossRepositorySearch()
        throws Exception
View Full Code Here

        break;

      Query query = QueryParser.parse(line, field, analyzer);
      System.out.println("Searching for: " + query.toString(field));

      Hits hits = searcher.search(query);
     
      if (repeat > 0) {                           // repeat & time as benchmark
        Date start = new Date();
        for (int i = 0; i < repeat; i++) {
          hits = searcher.search(query);
View Full Code Here

      Hits hits = searcher.search(query);
     
      if (repeat > 0) {                           // repeat & time as benchmark
        Date start = new Date();
        for (int i = 0; i < repeat; i++) {
          hits = searcher.search(query);
        }
        Date end = new Date();
        System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
      }
View Full Code Here

            return results;           
        }
       
        try
        {
            hits = searcher.search(query);
        }
        catch (IOException e)
        {
            List<ParsedObject> resultList = new ArrayList<ParsedObject>();
            SearchResults results = new SearchResultsImpl(resultList);
View Full Code Here

    private void assertRecordCount( RepositoryContentIndex index, int expectedCount )
        throws Exception
    {
        Query query = new MatchAllDocsQuery();
        Searcher searcher = (Searcher) index.getSearchable();
        Hits hits = searcher.search( query );
        assertEquals( "Expected Record Count for " + index.getId(), expectedCount, hits.length() );
    }

    private CrossRepositorySearch lookupCrossRepositorySearch()
        throws Exception
View Full Code Here

      int count = 0;
      while (scanner.next(key, results)) {
        String value = key.getRow().toString();
        LOG.debug("Scanned over " + key.getRow());
        Term term = new Term(rowkeyName, value);
        int hitCount = searcher.search(new TermQuery(term)).length();
        assertEquals("check row " + value, 1, hitCount);
        count++;
      }
      LOG.debug("Searcher.maxDoc: " + searcher.maxDoc());
      LOG.debug("IndexReader.numDocs: " + ((IndexSearcher)searcher).getIndexReader().numDocs());     
View Full Code Here

           
      if (repeat > 0) {                           // repeat & time as benchmark
        Date start = new Date();
        for (int i = 0; i < repeat; i++) {
          searcher.search(query, null, 100);
        }
        Date end = new Date();
        System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
      }
View Full Code Here

        break;

      Query query = QueryParser.parse(line, field, analyzer);
      System.out.println("Searching for: " + query.toString(field));

      Hits hits = searcher.search(query);
     
      if (repeat > 0) {                           // repeat & time as benchmark
        Date start = new Date();
        for (int i = 0; i < repeat; i++) {
          hits = searcher.search(query);
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.