Uploaded image for project: 'Spring Data for Apache Solr'
  1. Spring Data for Apache Solr
  2. DATASOLR-235

Boost is not being applied to Map fields

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5 M1 (Gosling)
    • Component/s: None
    • Labels:
      None

      Description

      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;
      
      	}
      

        Attachments

          Activity

            People

            Assignee:
            francisco.spaeth Francisco Spaeth
            Reporter:
            francisco.spaeth Francisco Spaeth
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: