mirror of https://github.com/apache/archiva.git
Reverting earlier change to SearchUtil
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@742863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6267a21d29
commit
f3e319b018
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.archiva.indexer.util.SearchUtil;
|
||||||
import org.apache.lucene.search.BooleanQuery;
|
import org.apache.lucene.search.BooleanQuery;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
|
@ -247,7 +248,7 @@ public class NexusRepositorySearch
|
||||||
|
|
||||||
for ( ArtifactInfo artifactInfo : artifactInfos )
|
for ( ArtifactInfo artifactInfo : artifactInfos )
|
||||||
{
|
{
|
||||||
String id = getHitId( artifactInfo.groupId, artifactInfo.artifactId );
|
String id = SearchUtil.getHitId( artifactInfo.groupId, artifactInfo.artifactId );
|
||||||
Map<String, SearchResultHit> hitsMap = results.getHitsMap();
|
Map<String, SearchResultHit> hitsMap = results.getHitsMap();
|
||||||
|
|
||||||
SearchResultHit hit = hitsMap.get( id );
|
SearchResultHit hit = hitsMap.get( id );
|
||||||
|
@ -313,7 +314,7 @@ public class NexusRepositorySearch
|
||||||
SearchResultHit hit = results.getHits().get( ( offset + i ) );
|
SearchResultHit hit = results.getHits().get( ( offset + i ) );
|
||||||
if( hit != null )
|
if( hit != null )
|
||||||
{
|
{
|
||||||
String id = getHitId( hit.getGroupId(), hit.getArtifactId() );
|
String id = SearchUtil.getHitId( hit.getGroupId(), hit.getArtifactId() );
|
||||||
paginated.addHit( id, hit );
|
paginated.addHit( id, hit );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -327,9 +328,4 @@ public class NexusRepositorySearch
|
||||||
|
|
||||||
return paginated;
|
return paginated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getHitId( String groupId, String artifactId )
|
|
||||||
{
|
|
||||||
return groupId + ":" + artifactId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.apache.archiva.indexer.util;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SearchUtil - utility class for search.
|
* SearchUtil - utility class for search.
|
||||||
*
|
*
|
||||||
|
@ -28,38 +26,6 @@ import org.apache.commons.lang.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class SearchUtil
|
public class SearchUtil
|
||||||
{
|
{
|
||||||
public static final String BYTECODE_KEYWORD = "bytecode:";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether the queryString has the bytecode keyword.
|
|
||||||
*
|
|
||||||
* @param queryString
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean isBytecodeSearch( String queryString )
|
|
||||||
{
|
|
||||||
if ( queryString.startsWith( BYTECODE_KEYWORD ) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the bytecode keyword from the query string.
|
|
||||||
*
|
|
||||||
* @param queryString
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String removeBytecodeKeyword( String queryString )
|
|
||||||
{
|
|
||||||
String qString = StringUtils.uncapitalize( queryString );
|
|
||||||
qString = StringUtils.remove( queryString, BYTECODE_KEYWORD );
|
|
||||||
|
|
||||||
return qString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getHitId( String groupId, String artifactId )
|
public static String getHitId( String groupId, String artifactId )
|
||||||
{
|
{
|
||||||
return groupId + ":" + artifactId;
|
return groupId + ":" + artifactId;
|
||||||
|
|
Loading…
Reference in New Issue