Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boost is not being applied to Map fields [DATASOLR-235] #361

Closed
spring-projects-issues opened this issue Apr 4, 2015 · 0 comments
Closed

Boost is not being applied to Map fields [DATASOLR-235] #361

spring-projects-issues opened this issue Apr 4, 2015 · 0 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Apr 4, 2015

Francisco Spaeth opened DATASOLR-235 and commented

When using @Indexed(boost?) with Map<?,?> fields (against MappingSolrConverter ), is expected that all SolrInputField resulting from the write process of such map would had its boost set accordingly, but its not being set. This issue can be reproduced with the following test:

	@Test
	public void testBoostOnWildcardField() {

		BeanWithBoost bean = new BeanWithBoost();
		
		bean.boostedMapWildcardField = new HashMap<String, String>();
		bean.boostedMapWildcardField.put("val1_boostedMapWildcardField", "value");

		bean.mapWildcardField = new HashMap<String, String>();
		bean.mapWildcardField.put("val1_mapWildcardField", "value");

		Map<String, SolrInputField> target = new HashMap<String, SolrInputField>();
		converter.write(bean, target);

		// configured boost
		Assert.assertEquals(0.5f, target.get("val1_boostedMapWildcardField").getBoost(), 0);
		// default boost
		Assert.assertEquals(1, target.get("val1_mapWildcardField").getBoost(), 0);

	}

	public static class BeanWithBoost {

		@Indexed(boost = 0.5f) String boostedRegularField;
		
		@Indexed(name="*_boostedMapWildcardField", boost = 0.5f) Map<String, String> boostedMapWildcardField;
		
		@Indexed String regularField;

		@Indexed(name="*_mapWildcardField")  Map<String, String> mapWildcardField;

	}

Referenced from: pull request #48, and commits 8524563, ee2fb8d, a0e9011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant