I've spent the past month or so trying to trace down why my search index is not cataloging the entire site. I've been reading up and it seems as though CCK nodes are not indexed by drupal if there is no information in the body field..? [http://drupal.org/node/69981]

Has anyone else found this? I have over 2000 nodes that I've imported as CCK and for the most part the body fields are empty, but there are about 6 custom fields filled with data.

If anyone has info or a solution to this, please let me know. There's a potential fix in the above link but I'm a little weary of editing core code.

Thanks!

Comments

BradM’s picture

It turns out that the issue wasn't what I thought it was. From what I understand, Drupal only indexes titles and bodies for nodes, so the extra CCK fields are not indexed.

A possible solution was posted here:
http://drupal.org/node/69981

in search.module, (v 1.209.2.5 2007/07/26 19:16:48) about line 452 find this:

function search_index($sid, $type, $text) {
$minimum_word_size = variable_get('minimum_word_size', 3);

then add this:

$extra_fields;
$bio = db_fetch_array(db_query('SELECT * FROM {content_type_bio} WHERE nid = %d', $sid));
foreach($bio as $bio_field) {
$extra_fields .= " ".$bio_field;
}
$text .= $extra_fields;

Next time you edit those nodes, and run cron, the extra fields will be in the search index. Huzzah!

Before I go editing the core, does this look like the best solution? I can search/find CCK node types if I use a string found in the title or body, but not if I use a string exclusive to one of the extra fields.

emdalton’s picture

I need this too. I sure would like to know if this will work before I go editing Drupal Core.

nruest’s picture

I tried that solution, and it does not appear to be working. My site is a little over half way indexed, and searching for specific values in a cck field is yielding no results. I did do a couple of queries for that same value on the search_index table and it yielded results. So what gives?

paganwinter’s picture

Subscribing...

silviojr’s picture

I'm using the field indexer module to handle with this problem - http://drupal.org/project/field_indexer

karens’s picture

Status: Active » Closed (won't fix)

Closing old issues. None of us is using the D5 version any more, so hard to provide any support. Sorry.