开发者

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:

  1. Solr isn't hierarchical by nature, it's denormalized so indexing a heirarchy is hard.
  2. 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).
  3. Drupal has a specific configuration related to nodes and modifying that, by default, wouldn't be the easiest.
  4. 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:

  1. hook_modify_query to modify the actual indexing of the node
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜