omitNorm property for domain in schema.xml in solr

Today, when I was testing a solr sorting problem, the index could not be established suddenly. I used the distributed solrCloud (version 4.7.2) and reported an exception - org.apache.solr.client.solrj.impl.CloudSolrServer$ RouteException: ERROR: [doc=0] cannot set an index-time boost, unindexed or norms are omitted for field cat: cat, to the effect that boost cannot be used for fields that are not indexed or ignored by standard factors, then I looked at my Configuration of cat domain in scheme.xml

<field name="cat" type="string" indexed="true" stored="true" multiValued="true"/>

It is true that the attribute of omitNorm is not written. From this, it can be concluded that if it is not written, the default is true, that is, the standard factor is ignored. At this time, if boost is set in this field again, the exception will be thrown

for(int i=0;i<10;i++){
	SolrInputDocument d = new SolrInputDocument();
//	d.setDocumentBoost(i);
	d.addField("id", i);
	d.addField("cat", "cat",i);//Use i as the standard factor, the result is wrong, the problem lies here,
	list.add(d);
}

 So if a domain wants to use standard silver, it must manually set omitNorm= false, otherwise it will report an error.

It is easy to think of another place here, that is, you can set boost at the document level. If you do this, what will be the result of setting and not setting omitNorm? I did some experiments myself, and the conclusions are as follows:

1. If omitNorm=true is set for this field, that is, the standard currency is ignored, then the standard currency will not work when using this field to query, but an exception will not be thrown.

2. If omitNorm=false is set, that is, the standard currency is not ignored, the standard currency will work when using this domain to query.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326529908&siteId=291194637