Hi daniel,

I need to sort my node finder results, in the default config the oldest articles are at first
and the newest at last. I patched the
function finder_query($query) in finder.module with: $query['orders'][] = "node.nid DESC";
to ensure that the newest nodes are on top.

This works very well on the Node Finder Result Page, but not for the autocomplete-Field.
The suggestions are sorted alphabetically, but its more importent to see the newest on top.

can you please tell me where to look to get this fixed?

or maybe you could make this to the default-method if "sorting options" in Autocomplete-
settings are not checked?

thanks in advance!

Comments

danielb’s picture

If you want to customise the suggestions/results using filtering or ordering, make a view of nodes, and create a 'Views finder', and sort the nodes in your view according to your preference. There are just too many sorting possibilities to bother trying to do better sorting in finder, when views already does this. Node Finder only supports a very light set of features at the moment.

dsms’s picture

yeah, we had this discussion in the Views Finder Feature Request.

I really need to use the Redirect to Node Option if a specific result is selected, so I have to stick to the Node-Finder.

can you just tell me where I have to look for the autocomplete-query? Then I can customize this on my own.

If this works out I could contribute this as a patch later... I am pretty sure that other users would like this too.

thanks!

danielb’s picture

Please do not change anything in the code of the finder modules, the current releases are only in alpha and your copy of the module will go out of date very quickly, and you will need to upgrade and lose your changes. There are many hook functions created by finder which will let you manipulate almost anything, however they are undocumented at this stage.

There isn't really an 'autocomplete query' since an autocomplete field does not understand such things as 'nodes' -- the query is constructed by the module 'Finder Node', and then converted to SQL and executed by 'Finder', however the workflow that leads to this query is initiated by Finder Autocomplete - though there is no way to pass along a sort option this early in the process. You may be able to simply manipulate the query using hook_finder_query_alter(&$query) by checking the $query array for certain values (like the correct table and match conditions) - however be careful with this because this query function is also used by Finder for other database interaction.

I would still recommend using 'Finder Views', as it is very very easy to just add your own custom redirect via the results theme function, whereas it is a bit tricky to create hook implementation to manipulate queries.

danielb’s picture

Oh and to stop the alphabetising of autocomplete options - untick 'sort options' in the element settings.

dsms’s picture

Hi, I will try out your suggestions from #3. It is too late to swtich to Views Finder again. I heavily changed the Result-Page of
Node-Finder, because my customer wants an ordering and grouping by its own fancy imagination... this would not even be
accomplished by the Views module ;) this works very well with node-finder since I can easily access the whole node-object to
rebuild the $result_array.

I know, hacking a module should be the last way to go but since I don't know how to build an own module using appropriate
finder hooks to accomplish the same result, I had no other choice. I know I loose the ability to update, but since the module
does what it should do there is no need to update (assuming there will not occure a security issue ;) )

nevertheless, there are much more drupal-projects in my near future, so there will always be a need for a fresh finder-version ;)

danielb’s picture

Status: Active » Closed (won't fix)

OK if you're going that route you might be better to do it in the finder_node module, or finder_find_query() you can even check if $finder->base_handler is 'node' (if memory serves)
I probably won't add sort options to node/user finder, I'd rather figure out the redirect issue in views.

dsms’s picture

I probably won't add sort options to node/user finder, I'd rather figure out the redirect issue in views.

Yes, you're right. Views Finder with a redirect-feature would be the very best way to go..

shv_rk’s picture

Component: Finder Node » Code

Hello,

I am using finder to create product filter search by using taxonomy and views, it works perfectly.
however, I want to make search result to show only product name, image, price and read more button.
now is showing thw whole node!
I could not find any documentations about how to modify search result page.
would you please give me some directions?