Doug got a start -- this is using the views fastsearch module as a base. he said he ran into some issues with Views 2 but didn't elaborate what the issues where so I'm not quite sure what to do with this.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | views.backlinks.patch | 2.07 KB | mfb |
| #17 | views.backlinks.patch | 2.2 KB | mfb |
| #17 | search.views_default.inc_.txt | 6.03 KB | mfb |
| #14 | views.backlinks.patch | 1.51 KB | mfb |
| #14 | search.views_default.inc_.txt | 6.03 KB | mfb |
Comments
Comment #1
merlinofchaos commentedComment #2
john morahan commentedSome initial fixes. I'll look at this again tomorrow.
Comment #3
merlinofchaos commentedA couple of quick comments:
The 'user' table is 'users'.
The use of "search_index.score" is not relationship-safe. I realize that with search a relationship may actually be invalid, but let's stick to convention here anyway. In general, you should never refer to a table by its name, but always use the return value from ->add_table or ->ensure_table which will give you the alias that was used.
Oh! And one thing -- views_join always puts {} around the table name. For temporary tables, it turns out this is wrong, so we probably either want a switch or we want to subclass views_join. I suspect we just want a switch since there's a lot of functionality already in there that isn't worth duplicating. That switch would remove the { } processing for temporary tables. I'm not sure this matters for the new search, mind you; I bring this up because it's a problem in Views 1 and D5.
Comment #4
john morahan commentedWell, this is still wrong. Specifically, I didn't get around to dealing with the temp tables, and it doesn't use the table alias - when I tried to do this, I discovered that most of views_handler_filter_search::query() doesn't actually work the way it seems to, and I'm not familiar enough with search to easily figure out what they should be doing. Nonetheless, this version does seem to actually work, at least for very simple views.
Requires #242243: add support for HAVING.
Comment #5
merlinofchaos commentedI've committed this; but knowing that this isn't fully ready, I'm leaving the issue open.
Comment #6
dmitrig01 commentedThat is bad - you can't always be sure the base table is node, and search_index.type is not node.type.
Search_index.type is 'node' or 'user' or 'advanced_help' (whatever the search hook starts with), node.type is node type.
Comment #7
merlinofchaos commentedWell, the line in question does appear ot be commented out.
Comment #8
mfbthe drupal 6/views 2 version of backlinks is pretty much ready for release -- http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/backlinks/?...
The one thing I noticed is that search.views.inc has some broken code re: search_node_links table, which is defined by backlinks module. This causes some dysfunctional 'Backlinks: Links To' and 'Backlinks: Links From' argument options to appear when backlinks is installed.
Comment #9
merlinofchaos commentedHmm. The search_node_links table appears to be in core. At least, I don't have the backlinks module on my site at all, but the search_node_links table is in my database.
Comment #10
mfbYes, what backlinks provided in drupal 5 was views integration for the search_index table, also part of search module.
Comment #11
merlinofchaos commentedAhh, so this really ought to be in Views proper, then? (Yes, my ignorance of search's mechanisms knows no bounds)
Comment #12
mfbThat would be fine with me. Take a look at the cvs link above, everything is in the views inc files. If you want to include just the contents of backlinks.views.inc then backlinks module could provide the default views to help non-techies figure out what to do. If you want to include backlinks.views_default.inc too then the module would be phased out.
Comment #13
merlinofchaos commentedHow about this: Roll me a patch, it shouldn't be too hard, and I'll take the default views too, assuming they're not overly complex.
Comment #14
mfbThis is what I have so far. One question: how would I allow two different columns in search_node_links to be joined on node nid? (this would be needed to provide a forward-links view in addition to backlinks view.)
Comment #15
merlinofchaos commentedTo accomplish that, the easiest way would be to create an alias of the table for the alternate join condition. That way from Views perspective they're really two different tables, and you can freely use one variant or the other or both in the same query.
Comment #16
moshe weitzman commentedFYI, the D6 version of search does not use temp tables so we escape that particular need for a little while. OG needs this feature so - subscribe.
Comment #17
mfbOK this patch handles both forward links and backlinks.
Comment #18
merlinofchaos commentedJust a quick note: I very much prefer this format:
That way all the *.views.inc files are consistent. Nothing major there.
Comment #19
mfbok I refactored.
Comment #20
merlinofchaos commentedCommitted. Thanks a ton, mfb!
Comment #21
mfbGreat, thanks! It's exciting to see this built in to Views.
If the state of search_node_links was any indication there are probably other problems in search.views.inc. Although these could be fixed in new issues.
Comment #22
merlinofchaos commentedI have no doubt that there are other issues in search, unfortunately. TO fix them I'll have to really get my hands dirty with search and I'm leaving that in the hopes that those who are good at search will take the time to figure out what all is wrong here. =)
But definitely they should be other issues at this point.
Comment #23
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #24
mvcThis is perhaps a stupid question, but how can I actually invoke this code?
I'm using Search: Search Terms as an exposed filter for my View, and expected to see Search: Snippet as a field, but it wasn't there. I added a print statement to template_preprocess_views_view_row_search() to see if it was ever called, but no luck. Then I tried
print_r($view)but still couldn't see the snippet anywhere. I finally produced the output I desired by adding this to the row style output template:This works fine. But as I aspire to improve my knowledge of views, if there's a better way to do this, I'd love to know. Many thanks.
Comment #25
jferjan commentedsubscribing
Comment #26
merlinofchaos commentedThe search snippet plugin never actually got finished apparently, so there is some code there but it does not work. That's a separate issue.