Would it be possible to limit indexing by a node's taxonomy terms in addition to node type?

I'm considering writing a submodule to accomplish this.

It may be easier to split my content into more content types, but it just seems redundant to do so for nodes that share identical fields. Creating separate search environments by taxonomy term or vocabulary would be perfect.

CommentFileSizeAuthor
#2 search_by_page_terms.zip4 KBgrasmash
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

If you want to write a sub-module, please do! You should be able to follow what Search by Page Nodes does, and simply add new options to limit by taxonomy. Realistically, given my other paid and Drupal volunteering work commitments, I would not be likely to add this feature any time soon, sorry! But if you write it, I would be happy to include it in the Search by Page distribution (assuming it follows the Drupal coding and doc standards, and especially if it has a Drupal 7 version).

grasmash’s picture

Ok, I wrote up a submodule for this. I'm not really all that familiar with Drupal coding and doc standards, but I've done my best to document the code and use native Drupal functions.

For some reason, I can't connect Drupal's git server at the moment, so I'm just going at add a zip of the submodule here.

I've tested this module on my site and it seems to be working well. Please let me know if there's anything that you'd like me to change, or if you find problems with it.

Glad to become a contributor! Thanks for making it easy!

jhodgdon’s picture

The code looks pretty good, and using a zip file is fine.

There were a few minor things that are not up to standards (extra whitespace at ends of lines, and a couple of comments that exceeded 80-character lines), but it is mostly pretty clean.

I'm a bit reluctant to add this to Search by Page though. For one thing, porting it to Drupal 7 will be quite a pain, since Taxonomy is a Field in D7, and the queries used in this module won't work. Also, all the other official SBP submodules have tests, so someone would need to write some tests (using the SimpleTest framework) before I could accept it into the official module. It's amazing how many bugs I found by writing tests for the other modules...

So maybe for now the best thing to do is to leave this attached here for anyone who might want to use it, and put a link on the project page to this issue, so people can find it. Thoughts?

grasmash’s picture

Sounds like a good plan for now. However, I'd like to try my hand at developing a few tests for this submodule and eventually have it committed to at least the D6 version.

I may also try to adapt it to D7, but I don't think that's in the near future.

jhodgdon’s picture

Sounds good!

jhodgdon’s picture

Version: 6.x-1.9 » 7.x-1.x-dev
Issue summary: View changes