I have created a computed index field for our custom Lucene search index, and I have noticed that the contents do not get automatically added to the "_content" field in Lucene.

I would like to be able to search "_content" and find results that match any field including my computed index field.

I've read that I can add my computed field as part of "_content" just by naming it _content in the config:

<fields hint="raw:AddComputedIndexField">
    <field fieldName="_content">Project.Domain.Search.ComputedFields.PageTaxonomies, Project.Domain</field>

I would like to boost any search results where the search terms are found in PageTaxonomies. But where can I apply the boost for this field if the field has the same name as _content?

Any help appreciated!

  • 2
    Could you explain why you want the computed index field to be part of the default '_content' field being indexed - which one might discuss is a good idea or not - and not just search for results in both fields, but then boosting the computed index field? Commented Dec 5, 2016 at 18:49
  • @SørenEngel I agree that is the better approach. Since we already had a service that was working by searching "_content" I initially thought it was a bad idea to modify that to search a new field too
    – DaveBeta
    Commented Dec 15, 2016 at 12:51
  • @DaveBeta Have you been able to achieve what you wanted? If the advice from Vicent's answer hasn't worked for you, consider editing your question to include more detail about the current state of your problem. Commented Dec 15, 2016 at 14:30

1 Answer 1


I would use a different field for your computed field, so it's easier to boost. if this is not possible, you'll have to use some tricks, as you can't distinguish the values coming from a different field.

The trick: Add a token to your value so you can identify and boost it

Assuming that for some reason you need the original value of your taxonomy, add a duplicated value to your value with a special token, then boost the search for that term: Let's say that your computer field now returns "taxonomy1"; modify your code to return "taxonomy1|mytokentaxonomy1" On your search, add an "or" with the "extra" value.

var queryPredicate = PredicateBuilder.True<SearchResult>();
queryPredicate = queryPredicate.And(i =>
                            i.YourField.Equals("taxonomy1") || i.YourField.Equals("mytokentaxonomy1").Boost(50));

This way, you are sure that the value you are generating with your computed field is boosted. If you don't need the original value, you can just use the special value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.