forked from tesla/m2e-core-tests
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Final touches before SearchEngine removal.
Api changes needed to express various search cases, but not yet done. Known to fail: org.eclipse.m2e.tests.internal.index.NexusIndexManagerSearchTest.testPluginSearch() org.eclipse.m2e.tests.internal.index.NexusIndexManagerTest.testWorkspaceIndex() org.eclipse.m2e.tests.internal.index.NexusIndexManagerTest.testIndexedPublicArtifactGroups() org.eclipse.m2e.tests.internal.index.NexusIndexManagerTest.testPublicMirror()
- Loading branch information
Showing
20 changed files
with
440 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
org.eclipse.m2e.core/src/org/eclipse/m2e/core/index/MatchTyped.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008 Sonatype, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.m2e.core.index; | ||
|
||
/** | ||
* MatchTyped is a interface that describes the wanted match type to be used. | ||
* | ||
* @author cstamas | ||
*/ | ||
public interface MatchTyped { | ||
|
||
public enum MatchType { | ||
/** Exact match wanted */ | ||
EXACT, | ||
/** Partial match wanted, like prefix, contains, etc. */ | ||
PARTIAL; | ||
}; | ||
|
||
MatchType getMatchType(); | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
org.eclipse.m2e.core/src/org/eclipse/m2e/core/index/MatchTypedStringSearchExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008 Sonatype, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.m2e.core.index; | ||
|
||
/** | ||
* MatchTypedStringSearchExpression | ||
* | ||
* @author cstamas | ||
*/ | ||
public class MatchTypedStringSearchExpression extends StringSearchExpression implements MatchTyped { | ||
|
||
private final MatchType matchType; | ||
|
||
public MatchTypedStringSearchExpression(final String expression, final MatchType matchType) { | ||
super(expression); | ||
this.matchType = matchType; | ||
} | ||
|
||
public MatchType getMatchType() { | ||
return matchType; | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
org.eclipse.m2e.core/src/org/eclipse/m2e/core/index/SearchExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008 Sonatype, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.m2e.core.index; | ||
|
||
/** | ||
* SearchExpression is a wrapper interface for expressions representable as plain strings to be used within searches. | ||
* | ||
* @author cstamas | ||
*/ | ||
public interface SearchExpression { | ||
|
||
/** | ||
* Returns the expression value as plain java String. | ||
* | ||
* @return | ||
*/ | ||
String getStringValue(); | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
org.eclipse.m2e.core/src/org/eclipse/m2e/core/index/SourcedSearchExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008 Sonatype, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.m2e.core.index; | ||
|
||
/** | ||
* SourcedSearchExpression is a search expression usually "sourced" from some programmatic source, and we already know | ||
* it is complete, exact value that we want to search for. Indexer will try to match exactly the provided string value, | ||
* no more no less. | ||
* | ||
* @author cstamas | ||
*/ | ||
public class SourcedSearchExpression extends MatchTypedStringSearchExpression { | ||
|
||
public SourcedSearchExpression(String expression) { | ||
super(expression, MatchType.EXACT); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
org.eclipse.m2e.core/src/org/eclipse/m2e/core/index/StringSearchExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008 Sonatype, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.m2e.core.index; | ||
|
||
/** | ||
* StringSearchExpression is a SearchExpression that has String value. | ||
* | ||
* @author cstamas | ||
*/ | ||
public class StringSearchExpression implements SearchExpression { | ||
|
||
private final String expression; | ||
|
||
public StringSearchExpression(String expression) { | ||
assert expression != null && expression.trim().length() > 0 : "The expression cannot be empty!"; | ||
this.expression = expression; | ||
} | ||
|
||
public String getStringValue() { | ||
return expression; | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
org.eclipse.m2e.core/src/org/eclipse/m2e/core/index/UserInputSearchExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008 Sonatype, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.m2e.core.index; | ||
|
||
/** | ||
* UserInputSearchExpression is a search expression usually coming from user input (like some UI dialogue, element or | ||
* CLI). It will be normalized and tokenized and then a search will happen against it. Search expressions of this type | ||
* will always provide "broader" results, since it defaults to prefix searches. | ||
* | ||
* @author cstamas | ||
*/ | ||
public class UserInputSearchExpression extends MatchTypedStringSearchExpression { | ||
|
||
public UserInputSearchExpression(String expression) { | ||
super(expression, MatchType.PARTIAL); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.