Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When you perform a copyField in Solr, does the field boost go with it?

Tags:

solr

Say I have these field declarations:

<field name="Title" type="text_general" stored="true" multiValued="false" /> 
<field name="Body" type="text_general" stored="true" multiValued="false" /> 

When I index "Title," I set the boost to 5, meaning words in the "Title" field should count for 5x normal.

Then I do this:

<copyField source="Title" dest="SearchText"/>
<copyField source="Body" dest="SearchText"/>

So, I have copied both fields into another field called "SearchText."

When I search "SearchText," are terms from the "Title" field still carrying their 5x boost? Or do they lose that in the copy? When you do a copyField, does the boost of all fields get "leveled out"?

like image 719
Deane Avatar asked Dec 17 '12 19:12

Deane


1 Answers

After doing some reading, I think the boost gets stripped. Our solution was do to this:

We created four fields: SearchText, SearchText2, SearchText3, and SearchText4. We copy everything into SearchText, some stuff into SearchText2, less stuff into SearchText3, and only the super-critical stuff into SearchText4.

Then, our "qf" param looks like this:

SearchText, SearchText2^3, SearchText3^10, SearchText4^100

So, we're boosting the fields by none, 3, 10, and 100 at query time.

It doesn't look graceful, but it works well and it allows us to adjust boost without reindexing.

Also, there's an abstraction layer here: by putting something in SearchText2, for instance, we're saying "This is important," however, we're not defining how important (in terms of numeric boost) until query time. So, the copyField is the abstraction, and the "qf" param in the implementation.

like image 99
Deane Avatar answered Oct 27 '22 10:10

Deane