Hi daniel,

I really like the "Redirect to node" options in Node Finder Advanced settings,
and I would like to see this feature in Views Finder too. This is especially
interessting if one want to use the View to build autocomplete-suggestions
only. The View result-page should just be a fallback if the user didn't find
the appropriate result in the first step.

Moreover, I would like to see an other option in "Redirect to node" settings:

"Redirect to the only result node, or redirect to Advanced Search page if there are multiple results."

this would really make sense if one use finder for really big datasets, for example body-text
of all nodes. this should avoid performance bottlenecks and the admin could decide which
search mode fits best for his use case.

thanks in advance!!

CommentFileSizeAuthor
#11 finder.txt2.91 KBFidelix

Comments

dsms’s picture

well, I forgot to mention that the first feature-request makes only sense on Views from type 'node',
but maybe this could be extended to taxonomy, users, comments etc. as well.

danielb’s picture

Yes I've thought about this, I just don't know how to implement it. The current way views finder works is that it handles all kinds of views the same way. If we have to start redirecting then it has to be done on a case by case basis, because the path for users/taxonomy/comments/nodes are all different, and there is no function like drupal_path_to_object('comment', 35) which it would be really freakin good if there was. Additionally the users/taxonomy/comments/nodes can be added to by views plugin modules, and those cases there would be no way to redirect to anything at all.
I thought it would be great if I could scan the result for the first result for a path/url to use, and then it would be up to the person making the view to ensure there was a link to the object in there.
Still thinking about it. I would rather not have to do it case-by-case, but if I do, then there would also need to be a hook for modules to add/modify the default path calculation.

I don't know what you mean by Advanced Search - do you mean the search module? You could override theme_finder_results() and do a drupal_goto if you wanted some custom redirects on certain conditions. There is also some search module integration available in Finder Search, but it is not that great for wierd values or complex finders at this stage.

dsms’s picture

yes, I mean a redirect to the drupal search module. I hope for the Node Finder this would be quickly done.

For the views finder.. an option would it be to provide this feature at first only for nodes, since most of
the users would search for nodes. I dont know if it is hard to get the node IDs from Views results, but if,
you can easily redirect to url('node/'.$node_id), this works of course in the same way for taxonomy
and users, only for content with no own url appears the mentioned problem. so if you could discover the
view type from the given view, just throw it into the url-function and see what happens :D

danielb’s picture

Title: Redirect to node options » Finder Views: redirect to result
danielb’s picture

Status: Active » Fixed

I have added support for this like so

<?php

function finder_views_goto_result($finder, $result) {
  // allow modules to step in and make a redirect first, or change the $result.
  drupal_alter('finder_views_goto_result', $result, $finder);
  $id = &$result->{$result->base_field};
  switch ($result->base_table) {
    case 'node':
      drupal_goto('node/'. $id);
    case 'user':
      drupal_goto('user/'. $id);
    case 'term_data':
      drupal_goto('taxonomy/term/'. $id);
    case 'node_revisions':
      $revision = node_load(array('vid' => $id));
      drupal_goto('node/'. $revision->nid .'/revisions/'. $id .'/view');
    case 'files':
      $query = 'SELECT filepath FROM {files} f WHERE f.fid = %d';
      $file = db_fetch_object(db_query($query, $id));
      file_download($file->filepath);
  }
}


?>

I welcome any suggestions for improvement??

dsms’s picture

thats great!! I will try this out during the next days.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hbevan’s picture

So did this work? I'm after similar functionality - where would this code go, as a patch to the finder_views module?

truebluejw’s picture

Component: Finder Views » Code

A little trick I found was to make the view of a finder auto-complete item "search/node". This way you can use the auto-complete, direct to a node, and if you do a search, it will pass the search terms to the search url instead of the finder url

Fidelix’s picture

Is this implemented yet?
Users are not being redirected to the first result, i dont know why.
The view type is Node.

Fidelix’s picture

Category: feature » bug
Status: Closed (fixed) » Active
StatusFileSize
new2.91 KB

Here is my finder:

danielb’s picture

Category: bug » feature
Status: Active » Closed (fixed)

Yes the support was added. You have not identified a bug, please in future start a new issue for support questions.
The answer to your problem is that you have selected "best" in the finder result redirect options (or whatever it is called), which only redirects to the first result if there is only a single result. You need to choose a different option (I think it is called "always").

Fidelix’s picture

But even if there is only one result, the user is still redirected to the search page, with the single result.

shv_rk’s picture

Hi there,

I am usung Finder plugin to filter my products. which works perfectly.
but the search result page shows the whole node.
I wan to chage it to show only product name, image, read more button.
how can I do that?
I need some directions plz

thx

Fidelix’s picture

You need to use a views display as the result page.

Create a view that looks exactly how you want it to be, then set that view to be used on your finder settings, under "Results output" or something like that.

It works fine here for me. But this issue is about having a single result and redirecting to it. This feature does not work for me.

shv_rk’s picture

Hi Fidlex,

thanks for the reply and help.
I have created my view (finder_result_page) and under the Result page section:
Results page:
Build results page from "Output display".
Build custom results page.
"Output display" is configured under the "Views displays" fieldset above. Custom results page can be themed using theme_finder_views_results($results, $finder, $form_state).

I have chosen => Build custom results page.

but I don't understand how can I associates my view with the findet output page.
there in no option in the module to specify which view to use!

Sh

Fidelix’s picture

As i said, you should NOT choose "Build custom results page", as that will make finder build the results itself, and only use views to make the query for the results.

You should choose: "Build results page from "Output display"."

Which you should chose above in the fieldset "Views displays".

Regards.

shv_rk’s picture

Finally got it! :D thanks Fidelix

Michsk’s picture

Status: Closed (fixed) » Active

may i suggest implementing facebook statuses, i have already implemented it with succes (not that it was that much work)

function finder_views_path($table, $id) {
  switch ($table) {
    case 'node':
      return 'node/'. $id;
    case 'users':
      return 'user/'. $id;
    case 'term_data':
      return 'taxonomy/term/'. $id;
    case 'node_revisions':
      $revision = node_load(array('vid' => $id));
      return 'node/'. $revision->nid .'/revisions/'. $id .'/view';
    case 'files':
      $query = 'SELECT filepath FROM {files} f WHERE f.fid = %d';
      $file = db_fetch_object(db_query($query, $id));
      return $file->filepath;
    case 'facebook_status':
      return 'statuses/'. $id;
  }
}
icecreamyou’s picture

I don't actually use Finder, but as the maintainer of Facebook-style Statuses, I'd like to see the change suggested in #19. :) If it happens I'll add Finder to the list of integrated modules.

danielb’s picture

Status: Active » Closed (fixed)

This issue was solved a long time ago. Please don't confuse me.

Fidelix’s picture

These comments should be in a new issue, guys.