I can't get search to work.
I'm using drupal 4.0, but I upgraded search.module to 1.27 via cvs.
I've gone through all the admin menus, I enable "administer search"
and "search content". I search on a single word. I always get "no results".

when I display modules in the admin menu and click on "admin" in the
search module entry I get a blank page. Before I upgraded to 1.27
I got a page with a clickable link to "re-index" the database. Now I get
nothing. I was looking at the source code, but don't see anything obvious.

a friend has the same problem and he's using the stock 4.0 release.
any help is appreciated.

Comments

killes@www.drop.org’s picture

I'm using drupal 4.0, but I upgraded search.module to 1.27 via cvs.

This is not supported.
Searching works fine in drupal-4.0. What do you get if you simple put * in the form?

gstrock’s picture

ok, I dropped back to version 1.21 of search.module,
the version that ships with the 4.0 release.
I put a simple * in the form and "search yields no results".

I went to the admin screen of search.module and clicked on
"reindex all" and it produced this error message:
----
index invalidated
warning: Invalid argument supplied for foreach() in
/usr/www/htdocs/drupal/modules/search.module
on line 293. index recreated
----

Now if search does work in 4.0, and no one else has
this problem, perhaps its my configuration of php.
I'm running 4.2.3

gstrock’s picture

hmm.... I did one other change from the stock drupal 4.0.
I updated the image.module to the latest version, including
modifying the database with the mysql command file I
found there in CVS. That couldn't have screwed things up
could it?
My friend's drupal is closer to the stock install than mine,
and his search will return hits for "a*" , but not on other
patterns that should match like "bush" or "japan".
And yes I accessed his cron.php from a web browser,
several times, as well as wget, but "it no work". Only local images are allowed.

jibbajabba@iaslash.org’s picture

I installed 4.0 and then upgraded to CVS on this new site:

http://aifia.org/drupal/module.php?mod=search

but when you search * on the search page, you get nothing. Strange.

jibbajabba@iaslash.org’s picture

My problem on this new install might be that my cron.php is failing.

killes@www.drop.org’s picture

Definetely Cron rebuilds the searchindex.

jibbajabba@iaslash.org’s picture

was calling cron.php in my crontab rather than cron-lynx.sh. dumb.

killes@www.drop.org’s picture

Sorry about that, the asterisk only works if you enter something before.

crashpoint’s picture

hi
i read the above posts as i had enabled search through the blocks module and then whenever i was searching for anything i always used to get "your search yielded no results" . But as someone had pointed out run the cron.php in your root directory. I did that. Before doing that whenver i reindexed my site and then revisited the search settings page my site was 0% indexed. But after running cron it was 100% indexed. Thanks a lot to everyone for their inputs.

Steps to set up serach

activate the search block through administer -> blocks
run cron.php
reindex your site by going to administer -> search
search for something

blade003’s picture

thanks to crashpoint I resolved my search issue...

Steps to set up search:

1. activate the search block through administer -> blocks
2. run cron.php (found in the root directory)
3. reindex your site by going to administer -> search
4. search for something

it worked for me!!!!

Anonymous’s picture

wait a minute. I just tried entering an asterisk
into the search box at www.drupal.org and got
"no results". So that's not a valid test.

killes@www.drop.org’s picture

Well, then try a*

Anonymous’s picture

I think I frigging give up.
cron huh? well, ok, I setup cron to run on the hour.
I wget'd the cron.php file a whole buncha times.
I set $debug =1 in function _db_query() in includes/database.mysql.inc
and it produced the output below when I click on "re-index all".
Obviously if no one else has this error then its a problem with
my configuration of ... ? php? drupal? mysql?
I'm running Red Hat 7.2, apache 1.3.27, php 4.2.3, and drupal 4.0.
Seems like a winning combination, don't it? Only local images are allowed.
Looks like I'll be running drupal without search functionality.
- g.s.
-------------- error diarrhea -----------------------------------------
query: DELETE FROM variable WHERE name = 'comment_cron_last'
error:

query: INSERT INTO variable (name, value) VALUES ('comment_cron_last', '1')
error:

query: DELETE FROM variable WHERE name = 'node_cron_last'
error:

query: INSERT INTO variable (name, value) VALUES ('node_cron_last', '1')
error:
index invalidated

query: SELECT c.cid as lno, c.subject as text1, c.comment as text2 FROM comments c WHERE timestamp > 1
error:

query: DELETE FROM variable WHERE name = 'comment_cron_last'
error:

query: INSERT INTO variable (name, value) VALUES ('comment_cron_last', '1038809107')
error:

query: SELECT n.nid as lno, n.title as text1, n.body as text2 FROM node n WHERE n.status = 1 AND moderate = 0 and (created > 1 or changed > 1)
error:

query: DELETE from search_index where lno = '2' and type = 'node'
error:

query: INSERT INTO watchdog (uid, type, message, location, hostname, timestamp) VALUES ('1', 'error', 'warning: Invalid argument supplied for foreach() in /usr/www/gstrock.com/htdocs/drupal/modules/search.module on line 293.', '/drupal/admin.php?mod=search&op=reindex', '216.101.220.23', '1038809107')
error:
warning: Invalid argument supplied for foreach() in /home/gstrock/gstrock.com/htdocs/drupal/modules/search.module on line 293.

query: DELETE from search_index where lno = '3' and type = 'node'
error:

query: DELETE from search_index where lno = '4' and type = 'node'
error:

query: DELETE from search_index where lno = '5' and type = 'node'
error:

query: DELETE from search_index where lno = '6' and type = 'node'
error:

query: DELETE from search_index where lno = '7' and type = 'node'
error:

query: DELETE from search_index where lno = '8' and type = 'node'
error:

query: DELETE from search_index where lno = '9' and type = 'node'
error:

query: DELETE from search_index where lno = '10' and type = 'node'
error:

query: DELETE from search_index where lno = '11' and type = 'node'
error:

query: DELETE from search_index where lno = '12' and type = 'node'
error:

query: DELETE from search_index where lno = '13' and type = 'node'
error:

query: DELETE from search_index where lno = '14' and type = 'node'
error:

query: DELETE from search_index where lno = '15' and type = 'node'
error:

query: DELETE FROM variable WHERE name = 'node_cron_last'
error:

query: INSERT INTO variable (name, value) VALUES ('node_cron_last', '1038809107')
error:
index recreated
r

dries’s picture

Quick idea: does it still fail when you access cron.php using a regular browser instead of using wget?

killes@www.drop.org’s picture

Indeed, I had troubles with other drupal pages with wget. In v3 this worked fine. Do you know what broke it?

dries’s picture

No idea but my guess is that the search module relies on an environment variable or header that wget doesn't set/sent. If that is true, this should be documented in the search module's documentation ... Maybe we should try to reproduce the problem to verify this theory?

killes@www.drop.org’s picture

I was not referring specifically to the search module. However, I just tried again and the problem seems to have disappeared.

wol’s picture

Search works for material entered prior to about three weeks ago. It does not find anything new. Somehow or other, I can't get the indexing updated. Running cron.php originally generated an sql error at the comment module:

user error: You have an error in your SQL syntax near ':1039874770' at line 1 query: SELECT c.cid as lno, c.subject as text1, c.comment as text2 FROM comments c WHERE c.status = 0 AND timestamp > i:1039874770; in /home/httpd/htdocs/drupal4.1/includes/database.mysql.inc on line 69.

Disabling or re-enabling comments.php doesn't seem to have any effect, however.

Running 4.1RC

Any thoughts?

wol’s picture

I forgot to mention that the admin page for search does not appear anywhere. It is enabled, I am checked as having permission to administer it. Still looking for troubleshooting suggestions.

wol’s picture

I backed off to the older version of search.module and it works (reindexing is actually shown as an admin menu item and it does work.) I guess it is time to start learning about debugging php to figure out the difference. Any pointers besides use lots of print statements?

ax’s picture

http://www.php.net/manual/en/debugger.php. personally i would recommend (because i am using) Komodo.

viv-1’s picture

I am new to drupal using drupal 4.0, but when i am trying to search anything it returns an error at the top of the page:

user error: Unknown column 'b.abstract' in 'where clause' query: SELECT n.*, b.* FROM event b LEFT JOIN node n ON n.nid = b.nid AND n.lid = b.lid WHERE (n.title LIKE '%a*%' OR b.abstract LIKE '%a*%' OR b.details LIKE '%a*%' OR n.attributes LIKE '%a*%') ORDER BY n.timestamp DESC LIMIT 20 in /usr/local/drupal/drupal-4.0.0/includes/database.mysql.inc on line 56.

and "your search yielded no results"
Anyone help me out.
Thanks

Viv

ax’s picture

to version 1.8. this version "[removes] n.attributes from search query", which apparently is causing this error. if this doesn't work, file a bug report (you may file it anyway because this problem shouldn't be there).

other (and probably better) solution: update to drupal 4.1 (RC). the changes for getting fixes for old versions are quite small, especially for contrib modules.

disclaimer: i don't know much about event.module - any expert there with better info?

gene@csof.net’s picture

could anyone post a fix for a missing search_index table for a sql challenged audience? I'm getting this error when attempting to search in 4.1

user error: Table 'drupal_csof.search_index' doesn't exist
query: select s.lno as lno, c.nid as nid, c.subject as title, c.timestamp as created, u.uid as uid, u.name as name, s.count as count FROM search_index s, comments cLEFT JOIN users u ON c.uid = u.uid WHERE s.lno = c.cid AND s.type = 'comment' AND c.status = 0 AND s.word like 'nuclear' in /web/www.csof.net/includes/database.mysql.inc on line 69.

user error: Table 'drupal_csof.search_index' doesn't exist
query: select s.lno as lno, n.title as title, n.created as created, u.uid as uid, u.name as name, s.count as count FROM search_index s, node n LEFT JOIN users u ON n.uid = u.uid WHERE s.lno = n.nid AND s.type = 'node' AND s.word like 'nuclear' AND n.status = 1 in /web/www.csof.net/includes/database.mysql.inc on line 69.
ax’s picture

the database.mysql of the latest 4.1 says CREATE TABLE search_index (...), so it should be their. this was even in there in 4.0, so it cannot be an update error, neither. if you don't have it, check your installation and your database, ie. import the missing sql clause(s) from database.mysql.

mjwall’s picture

I installed 4.1, and search didn't work. After searching for answers, I saw these posts and installed the search.module from Drupal 4.0. Now there is an option for search on the admin page that allows me to reindex and search appears to be working.

It looks like the search admin was added to overall site configuration for 4.1, but the reindex option was missing.

Is this going to be fixed for future releases?

ax’s picture

in 4.1. you are right that the reindex admin option is missing, but that doesn't prevent search from working. the index is (re)created regularily by cron: many drupal modules (search, [...]) require you to setup a cron to your Drupal site. [...] check Cron system and crontab page in handbook. so if search doesn't work for you, your cron isn't setup / doesn't work.

you (and dries Only local images are allowed.) might also check this patch of mine that reenables "reindex all" and fixes a reindex in the search module times out with a fatal error by means of set_time_limit(0) and using status().

mjwall’s picture

Your right, search does work. It is the reindex. Sorry. I'll look into setting up cron.

I also looked in your sandbox and saw the diff. I'll go back and try that. Thanks for the help.

cybe@drupal.org’s picture

When I moved my database from my own computer to a server on the internet I did not upload the contents of the search index table, believing that a cron run would re-index the whole site, but apparently it hasn't. Apparently it has indexed a bit, but not everything! Is there a way to do a full reindex?

cybe@drupal.org’s picture

Please, any help on this would be greatly appreciated. Again: A great deal of articles on my site simply won't be found when searched for, don't seem to be in the index at all...

ax’s picture

mentioned somewhere below in this thread? it probably won't apply straight as it is of some age, but you should get the idea and be able to fix it yourself.

cybe@drupal.org’s picture

Well, I carefully applied the changes from search.diff into search.module and user.module and reindex all did appear in admin->modules->search, I clicked it hoping for a long wait indicating a reindexing, but got a empty admin screen - admin/search/reindex just like i would get one if I visited admin/search/urmur, so perhaps I didn't patch it right? I also ran the cron.php...

Seems to not have done the reindexing since I can't find all files I should be finding...

Any help anyone, or any hope of getting a reindex all in future Drupal releases?

ax’s picture

at http://cvs.drupal.org/viewcvs/contributions/for_review/0041.ax.user-sear... . this one should work - please try again and give feedback if it does / doesn't.

cybe@drupal.org’s picture

Works, very nice thank you Ax.

Although I decided to download my database (with MySQL-Front) from my ISP into my WAMP and run it there since my ISP has safe_mode on. Sure takes a long time...

Are you going to put that patch into Drupal? I think it's kind of handy in cases like mine. I had problems uploading my database to my ISP, and huge tables like the search index where particulary problematic. Have to look into it - why the MySQL server drops the connection rudely like that. Although I get dropped from IRC all the time (error 1054 if I remember correctly) Lously modem connection.

ax’s picture

Are you going to put that patch into Drupal? I think it's kind of handy in cases like mine. I had problems uploading my database to my ISP, and huge tables like the search index where particulary problematic.

it sure is handy - thats why i did it. unfortunately, it's not up to me to put that patch into the core - it's dries who decides. but even though this patch has been there for some months, he isn't really responsive :( well - maybe that patch helping you helps him to response and to decide. i hope.

mjwall’s picture

Ax's patch on search is not working for me. safe_mode is not on, and drupal says it is:
Invalidating Index
Index invalidated
Recreating Index
Index recreated
but it does not appear to have changed the database. Any ideas. Man, search seems so important to me, but I always have trouble with it. Thanks

cybe@drupal.org’s picture

A few months have past, I've updated to 4.2 and now notice that Search isn't working, I seem to only be able to find the very newest posts. Broken again?!

I grep search.module for a reindex and see there is something there, but I see no reindex in admin/system/modules/search/ should there be one?

I look at the patch Ax has provided but it seems 4.2 already has the reindexing??

Signed,

How I always manage to break my Drupal part #22

EDIT: Reapplyed Ax:s patch, reindexed, searched, it worked, my site is re-indexed, although the search gave me some nag, then I copied the origianl 4.2 search.module and user.module back, nonag

I still think the REINDEX feature should exist in drupal

Anonymous’s picture

I had the same problem, but after I ran cron.php search worked fine.
I had to install drupal on windows and cron jobs are a pain to set up
so it was never done

dallasgrant@newswire.ws’s picture

I was searching through this message because my search would not work at all on 4.5.1 I did not realize you needed to run a cron.php to get it to work. I have now set up my server to run the job every couple of hours. Thanks for the info!

reyrodriguez’s picture

this is what I get if I run a search at my site... any ideas?

warning: Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support at offset 81723392
in C:\FoxServ\www\modules\search.module on line 258.

warning: Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support at offset 81723392
in C:\FoxServ\www\modules\search.module on line 266.

Steven’s picture

Ask your admin to compile PHP with a newer version of PCRE (with UTF-8 support enabled).

--
If you have a problem, please search before posting a question.

jbklego@stickbob.com’s picture

any one know the actual command for cron?

kcorkum’s picture

All I did was go to www.k2chronicles.com/cron.php in my browser. After that my admin - settings - search went from 0% indexed to 100% indexed.

Hopefully it will be automatic, otherwise in my ISP control panel I will kick the job off every night at midnight.

Thanks for the tips again folks!!

Bernard Hurley’s picture

Is this the same problem? I get this running search:

warning: Compilation failed: characters with values > 255 are not yet supported in classes at offset 52 in /home/htdocs/hosted/firebird/barkusbooks.org.uk/modules/search.module on line 257.

warning: Compilation failed: characters with values > 255 are not yet supported in classes at offset 143 in /home/htdocs/hosted/firebird/barkusbooks.org.uk/modules/search.module on line 265.

peterthevicar’s picture

Hi Bernard, it's a PHP version problem. See my comment below for details of a simple workaround:

http://drupal.org/node/25970#comment-73743

peterthevicar
drupal site: lymingtonchurch.org

kdinnage’s picture

I made several discoveries with searching:

First, I still haven't dedicated the time to figure out how to use cron correctly. I was able to download the poormanscron module and set it up. When notifications appeared in the administration log, I knew it had done its thing.

Second, I think it may have made a difference that I manually ran the cron.php file. The reason I'm not sure is that this wasn't the biggest problem.

I really began to unravel the difficulties I had with searching when I took a good look at the search page itself (the one that comes up with the results -- if there are any). For starters my search button was working differently than the search button on the search page. This was very probably my fault as I am using a custom template. Having the button on the search page that actually worked helped. This told me that the site was being indexed (a relief). However, checking that the search button that appears on every page of your site (as part of the template) and that the button that appears on the search page work the same might not be a bad test.

The other thing I discovered as I studied the search results page is that the results appear below the instructions, and they appear "below the fold." Part of my problem after things were working was that I saw the instructions and figured that nothing had been found. (I'm still kicking myself.) After investigating the search settings, I changed the search help to appear as a link. This made the results much more visible to the unaware (apparently, that's me). I felt pretty silly dealing with this one.

Once I started solving the right problem, things started moving along.

shijina’s picture

I am using Drupal 4.6.5
The search is not working .It showing that Your search yielded no results.

Can anyone help me.

Should I have to change anything in cron.php

yongli’s picture

I had the same problem as you had. I read through previous posts and followed the instruction on how to run cron job on windows. After the first run of cron job, the search worked.

kod3brkr’s picture

I've been through this topic a few times because I was having problems with my search module. Now it searches and brings back results, but it doesn't search forum topics.

Check it out. http://www.victoriahosting.com

try to search for christmas, there's a page and a forum topic with that word in them...

no forum topic in the results.

anyone have any ideas?

geme4472’s picture

I've had the same problems... and not consistently among various Drupal installs. So, after getting fairly frustrated with the whole process, I installed the SQL Search (trip search) module. I've had it installed for all of five minutes, but preliminarily it is rocking my face off.

Cheers.

caspercash’s picture

Everytime I search for the word "sleep", it returns a page with an image(IE browser). In Firefox, a pop-up message returns "An error occurred".. I don't know what's wrong! Other words when searched, will either return the contents or no matches found which is what I expected.. I really don't understand why searching the word "sleep" returns a page with an image coming from the folder of the site..! Words like at, the, top, up and use also returns a page with an image(IE) and pops up a message "An error occurred"(Firefox)..I'm new to drupal.. Help me please... I'm using drupal 5.2 version.. :'(

caspercash’s picture

Yehey! I've solved it! It was just one of the contents of the node that has a function that displays the image(IE browser).. and about the 'An error occurred.' It was an error using the module 'active search' which is one of the module of 'jstools'.. What I've done was, I trace the 'sleep' word in the mysql database in the tables that were created by the search module and then I tried to view each node that are related by the word sleep.. One of those nodes shows the error and then I just edited it then save.. and then I run the cron manually in the administer->logs->status report..

johnphethean’s picture

This issue has obviously evolved along with Drupal...
I have an issue where the search works ok from the search page, but when you use the block, it returns the error
'warning: set_time_limit() has been disabled for security reasons in /home/xx/user/htdocs/includes/common.inc on line 1982.' and no results. I take it this is because it tries to run the cron before supplying results, and the cron is timing out? Any ideas on how I can disable this (as I have another method for running the cron). Using Drupal 5.1.