aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java')
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java40
1 files changed, 16 insertions, 24 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java b/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java
index 88c06635520..e3a5ce76ffb 100644
--- a/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java
@@ -244,30 +244,6 @@ public class IndexFactsTestCase {
assertTrue(session.getIndex("e").isExact());
}
- @Test
- public void testOverlappingAliases() {
- IndexInfoConfig cfg = new IndexInfoConfig(new IndexInfoConfig.Builder()
- .indexinfo(
- new Indexinfo.Builder()
- .name("music2")
- .command(
- new Command.Builder().indexname(
- "btitle").command("index"))
- .alias(new Alias.Builder().alias("title")
- .indexname("btitle"))).indexinfo(
- new Indexinfo.Builder().name("music").command(
- new Command.Builder().indexname("title")
- .command("index"))));
- try {
- new IndexModel(cfg, (QrSearchersConfig) null);
- fail("Excepted exception"); // (This is validated at deploy time)
- }
- catch (IllegalArgumentException e) {
- assertEquals("Tried adding the alias 'title' for the index name 'btitle' when the name 'title' already maps to 'title'",
- e.getMessage());
- }
- }
-
private Query newQuery(String queryString, IndexFacts indexFacts) {
Query query = new Query(queryString);
query.getModel().setExecution(new Execution(new Execution.Context(null, indexFacts, null, null, null)));
@@ -329,5 +305,21 @@ public class IndexFactsTestCase {
assertEquals("url:\"https foo bar\"", query1.getModel().getQueryTree().toString());
assertEquals("url:\"https foo bar\"", query2.getModel().getQueryTree().toString());
}
+
+ @Test
+ public void testConflictingAliases() {
+ SearchDefinition first = new SearchDefinition("first");
+ Index field1 = new Index("field1");
+ first.addIndex(field1);
+
+ SearchDefinition second = new SearchDefinition("second");
+ Index field2 = new Index("field2");
+ field2.addAlias("field1");
+ second.addIndex(field2);
+
+ // Alias to field1 conflics with field1 in the "union" search definition.
+ // Should not produce an exception (but a log message):
+ new IndexFacts(new IndexModel(Collections.emptyMap(), ImmutableList.of(first, second)));
+ }
}