aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2008-07-29 02:48:33 +0000
committerMaria Odea B. Ching <oching@apache.org>2008-07-29 02:48:33 +0000
commit13c799574c26123f1d469acfa242893d34002bfa (patch)
tree499a3713967d85791a365892891f685f2a1e604c /archiva-modules
parent7852da039b01fecef2e87ed00fa154e1c00519fb (diff)
downloadarchiva-13c799574c26123f1d469acfa242893d34002bfa.tar.gz
archiva-13c799574c26123f1d469acfa242893d34002bfa.zip
[MRM-892]
-instead of using different keywords like 'class:', 'package:' or 'method', just use one keyword for all which is 'bytecode:', user can just use the filtered search for specifics once it is implemented git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@680606 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java2
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java15
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf4
4 files changed, 11 insertions, 13 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java
index 022853a3d..dd0ded398 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java
@@ -148,7 +148,7 @@ public class IndexJavaPublicMethodsConsumer
bytecodeRecord.setFiles( files );
bytecodeRecord.setMethods( mapOfClassesAndMethods.get( METHODS ) );
bytecodeRecord.setArtifact( artifact );
- bytecodeRecord.setRepositoryId( artifact.getModel().getRepositoryId() );
+ bytecodeRecord.setRepositoryId( repoContent.getId() );
bytecodeIndex.modifyRecord( bytecodeRecord );
}
}
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java
index 6110374a1..c82097467 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java
@@ -81,7 +81,8 @@ public class SearchResults
{
hit = new SearchResultHit();
}
-
+
+ hit.setRepositoryId( bytecode.getRepositoryId() );
hit.addArtifact( bytecode.getArtifact() );
hit.setContext( null ); // TODO: provide context on why this is a valuable hit.
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
index b2bda65fe..39c3bb361 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
@@ -91,7 +91,7 @@ public class SearchAction
private static final String COMPLETE_QUERY_STRING_SEPARATOR = ";";
- private static final String[] BYTECODE_KEYWORDS = new String[] { "class:", "package:", "method:" };
+ private static final String BYTECODE_KEYWORD = "bytecode:";
public String quickSearch()
throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException
@@ -114,7 +114,7 @@ public class SearchAction
if( isBytecodeSearch( q ) )
{
- results = crossRepoSearch.searchForBytecode( getPrincipal(), selectedRepos, removeKeywords( q ), limits );
+ results = crossRepoSearch.searchForBytecode( getPrincipal(), selectedRepos, removeKeyword( q ), limits );
}
else
{
@@ -322,21 +322,18 @@ public class SearchAction
private boolean isBytecodeSearch( String queryString )
{
- if( queryString.startsWith( BYTECODE_KEYWORDS[0] ) || queryString.startsWith( BYTECODE_KEYWORDS[1] ) ||
- queryString.startsWith( BYTECODE_KEYWORDS[2] ) )
+ if( queryString.startsWith( BYTECODE_KEYWORD ) )
{
- return true;
+ return true;
}
return false;
}
- private String removeKeywords( String queryString )
+ private String removeKeyword( String queryString )
{
String qString = StringUtils.uncapitalize( queryString );
- qString = StringUtils.removeStart( queryString, BYTECODE_KEYWORDS[0] );
- qString = StringUtils.removeStart( qString, BYTECODE_KEYWORDS[1] );
- qString = StringUtils.removeStart( qString, BYTECODE_KEYWORDS[2] );
+ qString= StringUtils.remove( queryString, BYTECODE_KEYWORD );
return qString;
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf
index b37f28cac..14693aa87 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf
@@ -33,8 +33,8 @@
<p>
Enter your search terms. A variety of data will be searched for your keywords.<br/>
- To search for java classes, packages or methods, append the keywords "<i>class:</i>",
- "<i>package:</i>" or "<i>method:</i>" before your query. Example, class:MyClass
+ To search for java classes, packages or methods, append the keyword "<i>bytecode:</i>"
+ to your query. Example, bytecode:MyClass or bytecode:myMethod
<ww:actionerror/>
</p>
</div> \ No newline at end of file