Project

General

Profile

« Previous | Next » 

Revision 46587

implemented use of opt in/out rules for entity fields (#2557).
depending on specific solrj version (thus excluding cdh6.X versions)

View differences:

IndexConfigTest.java
34 34
					+ "{ relType = projectOrganization_participation_isParticipant, targetEntity = project, expandAs = rel, symmetric = true, fields = [legalname,legalshortname,websiteurl,country] }, "
35 35
					+ "{ relType = datasourceOrganization_provision_isProvidedBy, targetEntity = datasource, expandAs = rel, symmetric = true, fields = [legalname,legalshortname,websiteurl,country] }, "
36 36
					+ "{ relType = organizationOrganization_dedup_merges, targetEntity = organization, expandAs = child, symmetric = true, fields = [legalname,legalshortname,websiteurl,country] }, "
37
					+ "{ relType = organizationOrganization_dedup_isMergedIn, targetEntity = organization, expandAs = child, symmetric = true, fields = [legalname,legalshortname,websiteurl,country] }"
37
					+ "{ relType = organizationOrganization_dedup_isMergedIn, targetEntity = organization, expandAs = child, symmetric = true, fields = [legalname,legalshortname,websiteurl,country] }, "
38
					+ "{ relType = resultOrganization_affiliation_isAuthorInstitutionOf, targetEntity = result, expandAs = rel, symmetric = true, fields = [legalname,legalshortname,websiteurl,country] }"
38 39
					+ "]}, "
39 40
					+ "project { dups = false, links = ["
40 41
					+ "{ relType = projectOrganization_participation_hasParticipant, targetEntity = organization, expandAs = rel, symmetric = true, fields = [code,acronym,title,websiteurl,contracttype,fundingtree] }, "
41 42
					+ "{ relType = resultProject_outcome_produces, targetEntity = result, expandAs = rel, symmetric = true, fields = [code,acronym,title,websiteurl,contracttype,fundingtree] }, "
42 43
					+ "{ relType = projectPerson_contactPerson_hasContact, targetEntity = person, expandAs = rel, symmetric = true, fields = [code,acronym,title,websiteurl,contracttype,fundingtree] } "
43
					+ "]}} ";
44
					+ "], excludeFields = [jsonextrainfo,optional1,optional2]}} ";
44 45

  
46
	public static final String configWithIncludesExcludes =
47
			"index.conf { "
48
					+ "result { dups = true, links = ["
49
					+ "{ relType = resultResult_dedup_isMergedIn, targetEntity = result, expandAs = child, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,pid] }, "
50
					+ "{ relType = resultResult_dedup_merges, targetEntity = result, expandAs = child, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,pid] }, "
51
					+ "{ relType = resultResult_publicationDataset_isRelatedTo, targetEntity = result, expandAs = rel, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,pid,url,collectedfrom] },"
52
					+ "{ relType = resultResult_similarity_isAmongTopNSimilarDocuments, targetEntity = result, expandAs = rel, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,similarity,type,pid] },"
53
					+ "{ relType = resultResult_similarity_hasAmongTopNSimilarDocuments, targetEntity = result, expandAs = rel, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,similarity,type,pid] },"
54
					+ "{ relType = resultResult_supplement_isSupplementTo, targetEntity = result, expandAs = rel, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,similarity,type,pid,url,collectedfrom] },"
55
					+ "{ relType = resultResult_supplement_isSupplementedBy, targetEntity = result, expandAs = rel, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,similarity,type,pid,url,collectedfrom] },"
56
					+ "{ relType = resultResult_part_isPartOf, targetEntity = result, expandAs = rel, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,similarity,type,pid,url] },"
57
					+ "{ relType = resultResult_part_hasPart, targetEntity = result, expandAs = rel, symmetric = true, fields = [title,dateofacceptance,publisher,resulttype,similarity,type,pid,url] }"
58
					+ "], excludeFields = [jsonextrainfo] }, "
59
					+ "person { dups = false, links = ["
60
					+ "{ relType = personResult_authorship_isAuthorOf, targetEntity = result, expandAs = rel, symmetric = true, fields = [fullname,ranking,pid], max = 2 }, "
61
					+ "{ relType = projectPerson_contactPerson_isContact, targetEntity = project, expandAs = rel, symmetric = true, fields = [fullname,email,fax,phone] } "
62
					+ "], includeFields=[fullname, ranking]}"
63
					+ "}";
64

  
65
	public static final String wrongConfig =
66
			"index.conf { "
67
					+ "person { dups = false, links = ["
68
					+ "{ relType = personResult_authorship_isAuthorOf, targetEntity = result, expandAs = rel, symmetric = true, fields = [fullname,ranking,pid], max = 2 }, "
69
					+ "{ relType = projectPerson_contactPerson_isContact, targetEntity = project, expandAs = rel, symmetric = true, fields = [fullname,email,fax,phone] } "
70
					+ "], includeFields=[fullname, ranking], excludeFields=[email] }"
71
					+ "}";
72

  
73

  
45 74
	public static final String context = "[{id:'egi', label:'EGI', element:'context'}, "
46 75
			+ "{id:'egi::classification', label:'EGI classification scheme', element:'category'}, "
47 76
			+ "{id:'egi::classification::natsc', label:'Natural Sciences', element:'concept'}, "
......
88 117
				assertNotNull(relDescriptor.getRelType());
89 118
				assertNotNull(relDescriptor.getSubRelType());
90 119

  
91
				// System.out.println(ld);
120
				System.out.println(ld);
92 121
			}
93 122
		}
94 123
	}
95 124

  
125
	@Test
126
	public void testLoadEntityConfTableIncludeExclude() {
127
		final IndexConfig conf = IndexConfig.load(configWithIncludesExcludes);
128
		final EntityConfigTable map = conf.getConfigMap();
129
		assertNotNull(map);
130
		assertTrue(map.size() > 0);
131
		assertTrue(map.hasIncludeFields(Type.person));
132
		assertTrue(map.hasExcludeFields(Type.result));
133
	}
134

  
135
	@Test(expected = RuntimeException.class)
136
	public void testBothIncludeExclude() {
137
		final IndexConfig conf = IndexConfig.load(wrongConfig);
138
		final EntityConfigTable map = conf.getConfigMap();
139
	}
140

  
141

  
142

  
143

  
96 144
}

Also available in: Unified diff