How to index & search hierarchical nodes with solr + drupal + cck
My Drupal 6 site uses 3 custom node types that are hierarchically organized: page, book, library. I want to use Solr to index and search the content. I want the search to return only Book nodes in the results. But I want the search to use the contents of children (pages) and parents (libraries) when performing the search. Can开发者_如何学编程 Solr be configured to index & search in this way?
Thanks!
You are going to have a couple of issues with this:
- Solr isn't hierarchical by nature, it's denormalized so indexing a heirarchy is hard.
- You're going to have to figure out how to boost various terms/fields based on where in the hierarchy they are (is the library more important than the book, so to speak).
- Drupal has a specific configuration related to nodes and modifying that, by default, wouldn't be the easiest.
- The Solr implementation is tightly tied to the database, so modifying the configuration would probably take a lot of effort on your part.
I would recommend you don't try to implement this, but if you did you could look at the Apache Solr Attachments module. You would have to do something similar... basically:
- hook_modify_query to modify the actual indexing of the node
- custom theme your search results to display this hierarchy
Or you could create a single giant field with a bunch of searchable text and use that as part of your searches.
精彩评论