Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Feb 2009 at 15:45 UTC
Updated:
4 Mar 2009 at 12:50 UTC
Is there a way (hook or other) to add my own bias settings to use? I need to be able to sort the result by a CCK field, i.e. have nodes with a certain value higher up in the list.
Also, what is the default sort order? Is this changeable?
Comments
Comment #1
pwolanin commentedThe default sort order is by relevancy - i.e. the best match comes first.
Comment #2
janusman commentedTo me this idea would something like a hook that allows index-time boosts per node defined by modules...
Something like:
Question: Would the module author must also need to specify when a node needs reindexing? Or is that handled automatically after every node submission/insertion?
A common use case for this hook (that perhaps could ship with v1 of the module?) could be handling node stickiness in search results. This was touched way back in this comment.
Comment #3
pwolanin commented@janusman - in this case, why not alter the query parameters to add a boost function? I guess you'd need to make sure the field in question was indexed. We have been avoiding index-time boosts for the obvious reason that changing it requires re-indexing.
Comment #4
janusman commented@blackdog: @pwolanin told me the one answer for this: use hook_apachesolr_modify_query():
So you just need to replace tid:123 with your CCK field's name in the Solr index.
Comment #5
blackdog commentedGreat stuff!
The biggest problem was getting my CCK field indexed, found another hook for that which worked though (hook_apachesolr_update_index) and added the field to the schema.