Examples of MultiSearcher


Examples of org.apache.lucene.search.MultiSearcher

        searchableList.toArray( searchables );

        try
        {
            // Create a multi-searcher for looking up the information.
            MultiSearcher searcher = new MultiSearcher( searchables );

            // Perform the search.
            Hits hits = searcher.search( specificQuery );

            int hitCount = hits.length();

            // Now process the limits.
            results.setLimits( limits );
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher

        searchableList.toArray( searchables );

        try
        {
            // Create a multi-searcher for looking up the information.
            MultiSearcher searcher = new MultiSearcher( searchables );

            // Perform the search.
            Hits hits = searcher.search( specificQuery );

            int hitCount = hits.length();

            // Now process the limits.
            results.setLimits( limits );
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher

        CollectionUtils.transform( searchableList, searchableTransformer );

        Searchable searchables[] = new Searchable[searchableList.size()];
        searchableList.toArray( searchables );

        MultiSearcher searcher = null;

        try
        {
            // Create a multi-searcher for looking up the information.
            searcher = new MultiSearcher( searchables );

            // Perform the search.
            Hits hits = searcher.search( specificQuery );

            int hitCount = hits.length();

            // Now process the limits.
            results.setLimits( limits );
            results.setTotalHits( hitCount );

            int fetchCount = limits.getPageSize();
            int offset = ( limits.getSelectedPage() * limits.getPageSize() );

            if ( limits.getSelectedPage() == SearchResultLimits.ALL_PAGES )
            {
                fetchCount = hitCount;
                offset = 0;
            }

            // Goto offset.
            if ( offset < hitCount )
            {
                // only process if the offset is within the hit count.
                for ( int i = 0; i <= fetchCount; i++ )
                {
                    // Stop fetching if we are past the total # of available hits.
                    if ( offset + i >= hitCount )
                    {
                        break;
                    }

                    try
                    {
                        Document doc = hits.doc( offset + i );
                        LuceneRepositoryContentRecord record = converter.convert( doc );
                        results.addHit( record );
                    }
                    catch ( java.text.ParseException e )
                    {
                        getLogger().warn( "Unable to parse document into record: " + e.getMessage(), e );
                    }
                }
            }

        }
        catch ( IOException e )
        {
            getLogger().error( "Unable to setup multi-search: " + e.getMessage(), e );
        }
        finally
        {
            try
            {
                if ( searcher != null )
                {
                    searcher.close();
                }
            }
            catch ( IOException ie )
            {
                getLogger().error( "Unable to close index searcher: " + ie.getMessage(), ie );
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher

                        .size()];
                for (int i = 0; i < searchers.length; i++) {
                    searchers[i]= new IndexSearcher((Directory)(directories
                        .get(i)));
                }
                luceneSearcher = new MultiSearcher(searchers);
            } else {
                luceneSearcher = new IndexSearcher((Directory) (directories
                        .get(0)));
            }
    }
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher

        Searchable[] searchers = new Searchable[indexDirs.length];
        for (int i = 0; i < indexDirs.length; i++) {
          searchers[i] = new IndexSearcher((new File(indexDirs[i].
            toUri()).getAbsolutePath()));
        }
        searcher = new MultiSearcher(searchers);
      } else {
        throw new IOException("no index directory found");
      }

      HTable table = new HTable(conf, new Text(TABLE_NAME));
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher


    IndexSearcher searchers[]=new IndexSearcher[2];
    searchers[0] = new IndexSearcher(ramDir1);
    searchers[1] = new IndexSearcher(ramDir2);
    MultiSearcher multiSearcher=new MultiSearcher(searchers);
    query = QueryParser.parse("multi*", FIELD_NAME, new StandardAnalyzer());
    System.out.println("Searching for: " + query.toString(FIELD_NAME));
    //at this point the multisearcher calls combine(query[])
    hits = multiSearcher.search(query);

    //query = QueryParser.parse("multi*", FIELD_NAME, new StandardAnalyzer());
    Query expandedQueries[]=new Query[2];
    expandedQueries[0]=query.rewrite(reader1);
    expandedQueries[1]=query.rewrite(reader2);
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher


    IndexSearcher searchers[]=new IndexSearcher[2];
    searchers[0] = new IndexSearcher(ramDir1);
    searchers[1] = new IndexSearcher(ramDir2);
    MultiSearcher multiSearcher=new MultiSearcher(searchers);
    QueryParser parser=new QueryParser(FIELD_NAME, new StandardAnalyzer());
    query = parser.parse("multi*");
    System.out.println("Searching for: " + query.toString(FIELD_NAME));
    //at this point the multisearcher calls combine(query[])
    hits = multiSearcher.search(query);

    //query = QueryParser.parse("multi*", FIELD_NAME, new StandardAnalyzer());
    Query expandedQueries[]=new Query[2];
    expandedQueries[0]=query.rewrite(reader1);
    expandedQueries[1]=query.rewrite(reader2);
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher

        Searchable[] searchers = new Searchable[indexDirs.length];
        for (int i = 0; i < indexDirs.length; i++) {
          searchers[i] = new IndexSearcher((new File(indexDirs[i].getPath().
            toUri()).getAbsolutePath()));
        }
        searcher = new MultiSearcher(searchers);
      } else {
        throw new IOException("no index directory found");
      }

      HTable table = new HTable(conf, TABLE_NAME);
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher

        Searchable[] searchers = new Searchable[indexDirs.length];
        for (int i = 0; i < indexDirs.length; i++) {
          searchers[i] = new IndexSearcher((new File(indexDirs[i].getPath().
            toUri()).getAbsolutePath()));
        }
        searcher = new MultiSearcher(searchers);
      } else {
        throw new IOException("no index directory found");
      }

      HTable table = new HTable(conf, TABLE_NAME);
View Full Code Here

Examples of org.apache.lucene.search.MultiSearcher


    IndexSearcher searchers[]=new IndexSearcher[2];
    searchers[0] = new IndexSearcher(ramDir1);
    searchers[1] = new IndexSearcher(ramDir2);
    MultiSearcher multiSearcher=new MultiSearcher(searchers);
    QueryParser parser=new QueryParser(FIELD_NAME, new StandardAnalyzer());
    query = parser.parse("multi*");
    System.out.println("Searching for: " + query.toString(FIELD_NAME));
    //at this point the multisearcher calls combine(query[])
    hits = multiSearcher.search(query);

    //query = QueryParser.parse("multi*", FIELD_NAME, new StandardAnalyzer());
    Query expandedQueries[]=new Query[2];
    expandedQueries[0]=query.rewrite(reader1);
    expandedQueries[1]=query.rewrite(reader2);
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.