remove unneccessary codes in the searcher for tests

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@675099 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2008-07-09 06:12:15 +00:00
parent ce73f78809
commit 90ef668a99
1 changed files with 9 additions and 39 deletions

View File

@ -37,7 +37,6 @@ import org.apache.maven.archiva.indexer.bytecode.BytecodeHandlers;
import org.apache.maven.archiva.indexer.lucene.LuceneEntryConverter; import org.apache.maven.archiva.indexer.lucene.LuceneEntryConverter;
import org.apache.maven.archiva.indexer.lucene.LuceneQuery; import org.apache.maven.archiva.indexer.lucene.LuceneQuery;
import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord; import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
import org.apache.maven.archiva.indexer.search.CrossRepositorySearch;
import org.apache.maven.archiva.indexer.search.SearchResultLimits; import org.apache.maven.archiva.indexer.search.SearchResultLimits;
import org.apache.maven.archiva.indexer.search.SearchResults; import org.apache.maven.archiva.indexer.search.SearchResults;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -49,20 +48,14 @@ import org.slf4j.LoggerFactory;
* @author <a href="mailto:oching@apache.org">Maria Odea Ching</a> * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
* @version * @version
*/ */
public class IndexJavaPublicMethodsCrossRepositorySearch public class IndexJavaPublicMethodsCrossRepositorySearch
implements CrossRepositorySearch
{ {
private Logger log = LoggerFactory.getLogger( IndexJavaPublicMethodsCrossRepositorySearch.class ); private Logger log = LoggerFactory.getLogger( IndexJavaPublicMethodsCrossRepositorySearch.class );
private ManagedRepositoryConfiguration localIndexedRepo; private ManagedRepositoryConfiguration localIndexedRepo;
private RepositoryContentIndexFactory indexFactory; private RepositoryContentIndexFactory indexFactory;
public IndexJavaPublicMethodsCrossRepositorySearch()
{
}
public IndexJavaPublicMethodsCrossRepositorySearch( ManagedRepositoryConfiguration localIndexedRepo, RepositoryContentIndexFactory indexFactory ) public IndexJavaPublicMethodsCrossRepositorySearch( ManagedRepositoryConfiguration localIndexedRepo, RepositoryContentIndexFactory indexFactory )
{ {
this.localIndexedRepo = localIndexedRepo; this.localIndexedRepo = localIndexedRepo;
@ -70,40 +63,17 @@ public class IndexJavaPublicMethodsCrossRepositorySearch
} }
public SearchResults searchForBytecode( String principal, List<String> selectedRepos, String term, public SearchResults searchForBytecode( String principal, List<String> selectedRepos, String term,
SearchResultLimits limits ) SearchResultLimits limits ) throws ParseException
{ {
List<RepositoryContentIndex> indexes = new ArrayList<RepositoryContentIndex>(); List<RepositoryContentIndex> indexes = new ArrayList<RepositoryContentIndex>();
indexes.add( indexFactory.createBytecodeIndex( localIndexedRepo ) ); indexes.add( indexFactory.createBytecodeIndex( localIndexedRepo ) );
try QueryParser parser = new BytecodeHandlers().getQueryParser();
{ LuceneQuery query = new LuceneQuery( parser.parse( term ) );
QueryParser parser = new BytecodeHandlers().getQueryParser(); SearchResults results = searchAll( query, limits, indexes );
LuceneQuery query = new LuceneQuery( parser.parse( term ) ); results.getRepositories().add( localIndexedRepo );
SearchResults results = searchAll( query, limits, indexes );
results.getRepositories().add( localIndexedRepo ); return results;
return results;
}
catch ( ParseException e )
{
log.error( e.getMessage() );
}
return new SearchResults();
}
public SearchResults searchForChecksum( String principal, List<String> selectedRepos, String checksum,
SearchResultLimits limits )
{
// TODO Auto-generated method stub
return null;
}
public SearchResults searchForTerm( String principal, List<String> selectedRepos, String term,
SearchResultLimits limits )
{
// TODO Auto-generated method stub
return null;
} }
private SearchResults searchAll( LuceneQuery luceneQuery, SearchResultLimits limits, List<RepositoryContentIndex> indexes ) private SearchResults searchAll( LuceneQuery luceneQuery, SearchResultLimits limits, List<RepositoryContentIndex> indexes )