I want to create a weight bias for all of my node types.

Node Types:

  • Articles
  • Blog
  • Content

The situation:

Right now Articles will be mixed in with Blog and Content. What I want is whenever there is an "Articles" node returned I want them to show first no matter what. Second would be Blog, third would be Content.


What I have done:

I have looked into possibly trying to bias using the QueryElevationComponent but that elevates based on the Solr Doc ID which I would have to manually set for each node. I have also looked into boosting based on the value of a field but this is numerical in nature I would somehow need to get a numerical value associated with every document that was a reflection of the Content Type's order. This doesn't seem like the best way to go.




Results from hook_search_api_solr_search_results_alter

results (Array, 10 elements)
    15681 (Array, 3 elements)
        id (String, 5 characters ) 15681
        score (Float) 4.8259773
        fields (Array, 2 elements)
            search_api_id (String, 5 characters ) 15681
            search_api_relevance (Float) 4.8259773

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.