Faceted search with clean url's.
NOTE: this sandbox project is now full project:
http://drupal.org/project/taxonomy_facets
Taxonomy terms are used as Facets that will help users to filter content progressively. Similar to what the Faceted Search module does and similar to most good eCommerce sites, like Amazon. However this module is all about SEO, so unlike the Faceted Search module this module maintains clean URL's with each filter change. For example, if user applies the filters: Computer Monitors, Samsung, LCD, then the URL will look something like: http://sitename.com/products/computer-monitors/samsung/lcd .
Filters can be applied in various permutations, so producing clean URL for each unique filter combination will allow search engines to index a huge amount of landing pages.
Also, the Faceted Search module is not planned to be ported to Drupal 7 (whereas this module is a Drupal 7 module).
When a user arrives on the site via this URL, then the correct filters will be applied automatically and menu items will be highlighted / opened accordingly.
This module produces "menus" on the fly, i.e no need for rebuilding menus or indexing as the menu items are not Drupal menu items but just items in the block. This is useful for sites where taxonomies may change frequently.
Blocks are cached for performance.
http://drupal.org/project/taxonomy_facets
Reviews of other projects:
http://drupal.org/node/1521982#comment-5855022
http://drupal.org/node/1521982#comment-5857532
http://drupal.org/node/1526246#comment-5857664
http://drupal.org/node/1425720#comment-5892166
http://drupal.org/node/1478968#comment-5892194
http://drupal.org/node/1302786#comment-5894304
New reviews:
http://drupal.org/node/1302786#comment-5902482
http://drupal.org/node/1302786#comment-5909550
http://drupal.org/node/1211132#comment-5938382 , http://drupal.org/node/1211132#comment-5938034
Comment | File | Size | Author |
---|---|---|---|
#30 | drupalcs-result.txt | 1.37 KB | klausi |
#5 | drupalcs-result.txt | 48.37 KB | klausi |
#2 | pareview.pdf.zip | 3 MB | patrickd |
Comments
Comment #0.0
dark-o CreditAttribution: dark-o commentedadded bit about producing menus on the fly
Comment #1
patrickd CreditAttribution: patrickd commentedThe review was too large to be pasted in here.
I'll attach it on the next comment.
Comment #2
patrickd CreditAttribution: patrickd commentedHere it goes:
Comment #3
patrickd CreditAttribution: patrickd commentedPlease try fixing these coding standart issues by using http://ventral.org/pareview.
Switched back to needs review, so in-depth reviews won't be blocked by coding standart issues.
Comment #4
patrickd CreditAttribution: patrickd commentedComment #4.0
patrickd CreditAttribution: patrickd commentedadded bit about drupal 7
Comment #4.1
dark-o CreditAttribution: dark-o commentedadded link to faceted search module
Comment #4.2
dark-o CreditAttribution: dark-o commentedspel check
Comment #5
klausiIt appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Go and review some other project applications, so we can get back to yours sooner.
manual review:
Comment #6
dark-o CreditAttribution: dark-o commentedI fixed all as advised, however, I created hook_permission as you advised, but I cannot see my custom permissions apearing on permission page, is anything wrong with this code
Comment #7
dark-o CreditAttribution: dark-o commentedComment #7.0
dark-o CreditAttribution: dark-o commentedchange sentance about permutations
Comment #8
dark-o CreditAttribution: dark-o commentedComment #9
klausiThe response time for a review is now approaching 4 weeks. Get a review bonus and we will come back to your application sooner.
Comment #10
chertzogi installed your module, and the permissions showed up just fine. Not sure if you fixed that in the mean time though... On to some other stuff:
Here is what i did:
When i view the page /articles, i get this error 6 times.:
In addition, the links for the terms in vocabs 2 and 3 are set to '/article'.
I followed the configuration directions included in the README.txt, but apparently something is wrong. If i did something incorrectly, please update the readme, and let me know.
There are also a LOT of typos throughout all of your code. Not huge deal for comments, but things displayed to the user should probably be spelled correctly (a couple things in the settings form).
Also, it would probably be helpful if you named your blocks a little better. Instead of:
Maybe:
I think this is a great idea for a module, and definitely see some potential uses.
Comment #11
dark-o CreditAttribution: dark-o commentedThe Notice you describe happens when there are no url aliases for taxonomy term, but as you say you did check that they are there. Could you please provide SQL dump of the test database so that I can try to reproduce this error.
Thanks
Comment #12
soncco CreditAttribution: soncco commentedHi Darko
There are still files other than README.txt in the master branch, make sure to remove them. See also step 5 in http://drupal.org/node/1127732. In other words your master branch should be empty.
There some Drupal coding standards, check http://ventral.org/pareview/httpgitdrupalorgsandboxdarkokantic1334080git....
Please check correct indentation and punctuation in your code and comments.
Comment #13
dark-o CreditAttribution: dark-o commentedfixed errors and I think I cleaned master branch
Comment #14
soncco CreditAttribution: soncco commentedGood work! Your master is clean :)
However, add some full-stops in your comments, eg. taxo_faceted_navigation.module lines 4 and 6. Always begin comments uppercase and end with fullstop. There are also some grammatical issues, but nothing serious.
Keep going!
Comment #15
dark-o CreditAttribution: dark-o commentedfixed as advised
Comment #16
dark-o CreditAttribution: dark-o commentedComment #17
AmauriC CreditAttribution: AmauriC commentedHi,
You must add a .install file to delete variables when uninstalling with variable_del()
You should never use t() to translate variables
Ex :
$block_arr['title'] = t(taxonomy_vocabulary_load($vocabs[$arr_index_no]['vid'])->name);
There are encoding errors in README.txt
107 Home � Administration � Structure � Taxonomy � Computer Hardware
Comment #18
dark-o CreditAttribution: dark-o commentedThanks, fixed as advised
Comment #19
klausiOnly applications with a status of needs review that have been awaiting response from a reviewer for 4+ weeks can have the "critical" status. See http://drupal.org/node/894256
You have not listed any reviews of other project applications in your issue summary as strongly recommended here: http://drupal.org/node/1011698
Comment #20
dark-o CreditAttribution: dark-o commentedOk, will do
Comment #20.0
dark-o CreditAttribution: dark-o commentedremoved reference site as its still under development
Comment #21
dark-o CreditAttribution: dark-o commentedReviews of other projects:
http://drupal.org/node/1521982#comment-5855022
http://drupal.org/node/1521982#comment-5857532
http://drupal.org/node/1526246#comment-5857664
Comment #22
luxpaparazzi CreditAttribution: luxpaparazzi commentedI suppose this will become a very interesting module especially for e-commerce sites.
Ventral did not find any errors, and at a first glance I did not see any severe problems.
I found many spelling errors (even I did not search for them), and I find some of your comments are uneeded and better function names would be beneficial.
Here my review:
1. You should remove INSTALL.TXT as it does not contain any information.
2. You should place your template files into a "templates" directory
3. Check typos:
4. I'm not sure if shouting at the user is a good idea:
'#title' => t('Do NOT display link if empty'),
5. I suppose there should be no \n and unnessary spaces in t() functions.
... also I find it difficult to read some of your phrases, it would be better making them short and clear.
6. I would add a manula page break between the phrases, for readability.
7. No reachable code:
8. You could save some of your inline comments, by putting better variable names:
9. Comment does not give any additional information:
10. I suppose this function could be used more generic as it's name implies:
$term_has_nodes = taxo_faceted_navigation_check_if_term_has_nodes_underneath($vid, $term->tid);
I'll propose: taxo_faceted_navigation_get_subnodes
or: taxo_faceted_navigation_has_subnodes
11. You call twice the same function:
if (!$has_nodes) {
$display_item = FALSE;
}
}
12. I do think that many of your inline comments are not necessary. Example:
The code should be self-explained (especially if variables and functions are named correclty), and most of your comments only slow down the reading of the code.
13. Writing "the problem" assumes, people know all the problems you got during development. Would be better writing "a problem" ...
Comment #23
luxpaparazzi CreditAttribution: luxpaparazzi commentedRemoved PAReview: review bonus
You may add 3 new reviews and put it back.
You could consider starting by reviewing the following module if you had some time to offer: http://drupal.org/node/1302786
Comment #24
dark-o CreditAttribution: dark-o commentedThanks for detailed review.
I do not understand point
6. I would add a manula page break between the phrases, for readability.
Fixing other points
Thanks
Comment #25
luxpaparazzi CreditAttribution: luxpaparazzi commentedsorry I ment line break ^^
Comment #26
klausi@luxpaparazzi: Never tell people to remove comments from code! Comments can be more clear or variable names can be improved, but code is *never* fully self explaining and comments help a lot to understand what is done. There is no such thing as self explaining code.
Comment #27
dark-o CreditAttribution: dark-o commentedfixed and improved commetns. I will continue improving comments as I go along and will get my wife to spell check it at the end of this review.
Comment #27.0
dark-o CreditAttribution: dark-o commentedadded review of other projects
Comment #27.1
dark-o CreditAttribution: dark-o commentedadded git clone instructions
Comment #27.2
dark-o CreditAttribution: dark-o commentedchanged git clone sintax
Comment #27.3
dark-o CreditAttribution: dark-o commentedadded review
Comment #27.4
dark-o CreditAttribution: dark-o commentedadded review
Comment #27.5
dark-o CreditAttribution: dark-o commentedadded Not yet finished reviews:
Comment #27.6
dark-o CreditAttribution: dark-o commentedading review link
Comment #28
dark-o CreditAttribution: dark-o commentedhttp://drupal.org/node/1425720#comment-5892166
http://drupal.org/node/1478968#comment-5892194
http://drupal.org/node/1302786#comment-5894304
Comment #29
klausiThanks for your reviews, just make sure that you pick applications that did not get a review in a long time.
Review of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
manual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #30
klausiForgot attachment.
Comment #31
luxpaparazzi CreditAttribution: luxpaparazzi commentedSome typos / grammar issues:
- eaxample => example
- the order of Filters => the order of filters
- persistant => persistEnt
- t('Used for ordering terms in the urls, the lightest vocabulary will go to top (or beginning of the url), the heaviest will sink to the bottom (or end of url). Used for ordering of terms in the urls only, to order filters on the site go to the blocks admin page, Administration » Structure >> Blocks .')
I suppose there should already be some translation for "Administration", "Structure" and "Blocks", so I prefer using those translations, and concatanating the different t() blocks.
Also use the same separator "»" is different from ">>"
-
I don't get the 2nd comment-line.
-
If it's not there it's not there "already" does not make any sense here. (Maybe use "yet").
- Using "is not set" would also be better than using "is not there"
- Instead of urldecode, you should use drupal_encode_path: http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_enc...
You should really use correct form building functions, see http://api.drupal.org/api/drupal/includes!database!database.inc/function...
This is a security issue! You did it correctly at other places.
Comment #31.0
luxpaparazzi CreditAttribution: luxpaparazzi commentedadded new rewievs
Comment #31.1
dark-o CreditAttribution: dark-o commentedadded review
Comment #32
dark-o CreditAttribution: dark-o commented@klausi Thanks for review
If I only use 2 spaces I got this error by pareview script
92 | ERROR | Array indentation error, expected 6 spaces but found 4
93 | ERROR | Array indentation error, expected 6 spaces but found 4
etc..
http://ventral.org/pareview/httpgitdrupalorgsandboxdarkokantic1334080git
added check_plain to function taxo_faceted_navigation_get_term_name_from_id($tid) in .module
others fixed as advised
Comment #33
dark-o CreditAttribution: dark-o commented@luxpaparazzi
Thanks for review.
Where in the code is this relevant
Again, I don't understand, where is this in the code ?
Fixed all other issues.
Thanks
Comment #34
dark-o CreditAttribution: dark-o commentedComment #35
luxpaparazzi CreditAttribution: luxpaparazzi commented>> Instead of urldecode, you should use drupal_encode_path:
> Where in the code is this relevant
I suppose I found "urldecode" somewhere in your code ... don't remember exactly.
>> You should really use correct form building functions, see ....
> You should really use correct form building functions, see ....
The example is beneath my comment.
Comment #36
dark-o CreditAttribution: dark-o commentedfixed all issues.
Automated review reports
92 | ERROR | Array indentation error, expected 6 spaces but found 4
93 | ERROR | Array indentation error, expected 6 spaces but found 4
etc...
but i think this is problem with the script, as clausi pointed out in
http://drupal.org/node/1359516#comment-5896588
there should be only 2 spaces for each level of indentation
Comment #36.0
dark-o CreditAttribution: dark-o commentedading new review
Comment #36.1
dark-o CreditAttribution: dark-o commentedadded review
Comment #37
dark-o CreditAttribution: dark-o commentedNew reviews:
http://drupal.org/node/1302786#comment-5902482
http://drupal.org/node/1302786#comment-5909550
http://drupal.org/node/1211132#comment-5938382, http://drupal.org/node/1211132#comment-5938034
Ops, sorry, looks I added pareview security tag by mistake, I don't know how to remove it
Comment #38
patrickd CreditAttribution: patrickd commentedyou did not add it, you removed it ;)
please leave it for statistical purposes
Comment #39
cpliakas CreditAttribution: cpliakas commentedJust wanted to point out that there is some duplicate effort here, which I am definitely not opposed to but wanted to throw out there.
The Facet API module works with Apache Solr Search Integration, Search API, and core Search. It also has a Facet API Pretty Paths module that can be used to construct clean URLs.
Again, I am not opposed to duplicate effort because I think that it is healthy for projects to push one another, but I just want to make sure that the search solutions we are creating don't further fragment the community. We have done a lot of work to start re-using code across the various search projects specifically in the area of faceted navigation, and I wouldn't want to go the other way unless absolutely necessary.
Thanks,
Chris
Comment #40
Yorgg CreditAttribution: Yorgg commentedThe git repository seems to be unavailable.
Where can I get this so I can write a review?
Regards
Comment #41
patrickd CreditAttribution: patrickd commentedgit clone --branch 7.x-1.x http://git.drupal.org/sandbox/DarkoKantic/1334080 taxo_faceted_navigation
works without any problems for me
Comment #42
crobinson CreditAttribution: crobinson commentedThere has been ongoing code review for this module, so I'm trying to focus on items here that have not already been addressed.
1. Automated code review is still finding indentation errors. Darko, I think you misunderstood Klausi's comment. Example:
The fourth line should be indented two more spaces.
2. I reviewed the duplication referred to in http://drupal.org/node/1359516#comment-5942340.
These modules seem to do similar things, but they do them in very different ways and for different reasons. I applied the test "could reasonable contributions to another module produce the same functionality?" My answer was no. This module is valuable on its own.
3. USER EXPERIENCE (not code): I found the blocks difficult to manage. These aren't like menu_blocks where there might just be a few on the site - I could easily imagine dozens of them with enough vocabularies, especially on an e-Commerce or media/publishing site with extensive tagging. Once you have a few dozen it gets hard to keep track of them and differentiate when you move them around.
I was also confused about where to go to configure the blocks once I added them. (I expected to be able to configure them in the blocks page, when configuring each block.) Also, it was even more confusing if I changed which vocabularies mapped to these blocks. Removing a vocabulary from the list and then adding it back or adding a different one didn't behave as I had expected.
Your comments in the code don't make this much clearer:
You might want to consider an alternate mechanism similar to what menu_blocks does. Instead of asking the user to specify a block count and then configure a vocabulary to automatically appear in the next available block, in your admin screen provide an "Add Block" function that adds a new block. Then implement hook_block_configure()/hook_block_save() to give the user a simple setup form where they can pick the taxonomy. This would be a lot easier to understand and act more like other blocks. (You could also ask for a title so it didn't have to match the taxonomy vocab title.)
hook_block_info() should also show more than "Taxo Facet Filter 4". What is filter 4?
4. In hook_block_info() your delta pattern is "filter$i" and then in _view() you have to do extra work to get it back. Delta values are unique to your module. You can just use $i to save some code.
This is important for performance reasons because in block_view() your current logic requires you to do a for() loop across all possible block numbers. What if I have 50 blocks? On average this must for() through half the count, so if all 50 were displayed you would on average do the string build and comparison below it 25*25 times, when you could just use the value from $delta directly.
5. taxo_faceted_navigation.module 89-105: For repeated actions in hooks you should make calls like drupal_get_path just once and store it in a variable.
6. I can see some security and behavior issues with your hook_menu() implementation. First, if the user (not understanding what this is for) specifies something like 'user' or 'node' this could cause a lot of trouble. Second, of all the defaults in the world to choose I think 'articles' is the worst because it seems like a really common potential conflict and also not really where this module's "biggest" target audience is.
I am guessing you did not want to force the user into a specific initial prefix. That's your choice, but unless you want to change that decision you need to do sanity-checking here, at the very least looking for the most common Drupal special paths, or better still, querying menu_router for conflicting paths that don't match your page callback.
I couldn't find anything else. I think this module is a little rough in terms of user experience but the guidelines are a little slim on how to review those and opinions vary on "good UX". On the basis of code review, once the final items above are addressed (1, 4, 5, and 6) I feel this project can go to RTBC.
Comment #43
crobinson CreditAttribution: crobinson commentedOops, didn't see the PAReview security comment, adding back.
Comment #44
Yorgg CreditAttribution: Yorgg commentedAfter following the all the steps in the README.txt file, I read I already have the taxonomy URL alias set up as recommended in Installation step 3.
When I click "food" taxonomy term, the browser replies with "Not Found
The requested URL /articles/subjects/food was not found on this server."
The blocks did not generate valid links, event though I regenerated (+3000 Bulk alias) the path alias match [term:name] token. They all fail as described in the previous paragraph.
The subjects is the vocabulary name, and "food" is only a flat term. I am only using flat vocabulary.
Perhaps is the view to emulate Drupal core's handling of taxonomy/term?
I am using this since it is a part of my navigation system and I really need the view.
Sounds promising though.
Good luck.
Comment #45
crobinson CreditAttribution: crobinson commentedThe issues in http://drupal.org/node/1359516#comment-5945876 have not yet been addressed. This issue is not ready to be reviewed.
Comment #46
dark-o CreditAttribution: dark-o commented@crobinson
I have now re-writen block / filters addition process to be similar to than of block menu module. Blocks can now be added and positioned more naturally and intuitively by using standard block configure functionality. ( as Dries intended it).
Also added sanity check for first argument in menu callback, your point no 6. By the way its important that user can configure this first argument in the url for SEO purposes, for example if you are estate agent site you would need this to be "property".
All other points you mention are now fixed.
Thanks a lot for all your advice's
Comment #47
MiSc CreditAttribution: MiSc commentedOk, this looks like RTBC for me.
Comment #48
klausimanual review:
<script>alert('XSS');</script>
and add a taxo facted search block I will get a nasty javascript popup. Terms are user provided input and need to be sanitized before printing. Please read http://drupal.org/node/28984 again.Comment #49
dark-o CreditAttribution: dark-o commentedThanks for pointing out XSS exploit.
fixed all issues
issue no 3:
re:
I fixed
$wheres .= " AND n.type in (:node_types)";
re:
$joins .= 'INNER JOIN {taxonomy_index} ti' . $counter . ' ON n.nid = ti' . $counter . ' .nid ';
The $counter is my own variable declared in this function, so no user input should find way in here, and I can not see another way to do it as I am building this query dynamically in the loop.
Comment #50
klausiSorry for the delay. Make sure to review more project applications and get a new review bonus and this will get finished sooner.
There is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732
Review of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
But otherwise looks RTBC to me.
Comment #51
klausino objection in more than a week, so ...
Thanks for your contribution, Darko Kantic!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #52
dark-o CreditAttribution: dark-o commentedThanks clausi, sorry for slow come back on last fey issues from you last review. I have been busy at work, actually using your module ;), WSclient, and it works well, we are using it at La Poste to consume soap service from SAP application.
I have managed to move my module from from sandbox to full project:
http://drupal.org/project/taxonomy_facets
, but files are not showing on the page, I must have messed up something with git, do you have any idea what
Best regards and thank you for all your help in getting this module to full project.
Comment #53
dark-o CreditAttribution: dark-o commentedA OK, I managed to get download files to display.
http://drupal.org/project/taxonomy_facets
Thank you all for help in getting this project from sandbox to production.
Comment #53.0
dark-o CreditAttribution: dark-o commentedadded review
Comment #54.0
(not verified) CreditAttribution: commentedmoved to full project