ContentSource source = (ContentSource) contentSources.get( i ); String index = _indexDirectory + File.separator + String.valueOf( source.getContentSourceId() ); File testFile = new File( index ); if (testFile.exists()) { tmp[i] = index; count++; }
documents = QueryTask.search( indeces, query.getSearchQueryCriteria() ); queryResults.put( query, documents );
    private void createSearchReports( IReportSource obj ) throws TorqueException    {        List queries = obj.getSearchQuerys();                if (!queries.isEmpty())        {            List contentSources = obj.getContentSources();            List documents = null;            ListMap queryResults = new ArrayMap();            String[] tmp, indeces;            // determine all indeces to use for searching, one index per content source            tmp = new String[contentSources.size()];            int count = 0;            for (int i = 0; i < contentSources.size(); i++)            {                ContentSource source = (ContentSource) contentSources.get( i );                String index = _indexDirectory + File.separator + String.valueOf( source.getContentSourceId() );                File testFile = new File( index );                if (testFile.exists())                {                    tmp[i] = index;                    count++;                }            }            indeces = new String[count];            System.arraycopy( tmp, 0, indeces, 0, count );            for (Iterator it = queries.iterator(); it.hasNext();)            {                SearchQuery query = (SearchQuery) it.next();                try                {                    documents = QueryTask.search( indeces, query.getSearchQueryCriteria() );                    queryResults.put( query, documents );                }                catch ( IOException e )                {                    logger.error( e );                }                catch ( ParseException e )                {                    logger.error( e );                }            }            ReportGeneratorFactory.getReportGenerator().generate( obj, queryResults );        }    }