I get this error when searching for "mechanism"

* user warning: Unknown column 'n.nid' in 'field list' query: SELECT COUNT(DISTINCT(n.nid)) FROM (SELECT n.nid, CEILING(SUM(completeness)) completeness, SUM(score) score FROM search_fuzzy_index AS n WHERE (ngram = 'mec' AND completeness <20.1) OR (ngram = 'ech' AND completeness <20.1) OR (ngram = 'cha' AND completeness <20.1) OR (ngram = 'han' AND completeness <20.1) OR (ngram = 'ani' AND completeness <20.1) OR (ngram = 'nis' AND completeness <20.1) OR (ngram = 'ism' AND completeness <20.1) GROUP BY word_id HAVING SUM(completeness) > 40 ORDER BY completeness DESC, score DESC) AS n in /var/www/NS5/includes/database.mysql.inc on line 172.

* user warning: Unknown column 'ngram' in 'where clause' query: SELECT n.nid, SUM(percent) AS completeness, SUM(score) AS score FROM (SELECT n.nid, SUM(completeness) percent, SUM(score) score FROM search_fuzzy_index AS s LEFT JOIN node AS n ON (n.nid = s.nid) WHERE (( (ngram = 'mec' AND completeness <20.1) OR (ngram = 'ech' AND completeness <20.1) OR (ngram = 'cha' AND completeness <20.1) OR (ngram = 'han' AND completeness <20.1) OR (ngram = 'ani' AND completeness <20.1) OR (ngram = 'nis' AND completeness <20.1) OR (ngram = 'ism' AND completeness <20.1)) AND n.status = 1) GROUP BY word_id HAVING percent > 40) AS n GROUP BY n.nid ORDER BY completeness DESC, score DESC LIMIT 0, 10 in /var/www/NS5/includes/database.mysql.inc on line 172.

It appears to me that there is some sort of mismatch between the what search table is and what it is expected to be...but that's a guess, I haven't really dug into it.

I'm running Drupal 5.1, MySQL 5.0.38, and PHP 5.2.1.

Thanks, and thanks for working towards a new search implementation, the core search is a little rudimentary.

Jared

Comments

BlakeLucchesi’s picture

I think the error has to do with an older version of the database schema being loaded. Which means you probably had version 1.x installed and then updated your code to the new dev snapshot.

I would recommend deleting both the tables search_index_queue and search_fuzzy_index and then reinstalling the fuzzysearch module. This will rebuild the two tables with the proper column names. (I changed a few column names to be more descriptive when I changed the algorithm up a bit).

Also, as a side note, the reason it is showing both queries is because in using the pager_query function I had to specify two different queries, one for grabbing the results, and one for counting how many results there are. This was done because the pager_query function tries to automatically rewrite your query to gather how many results there are but this query was too difficult and resulted in errors when it was automatically done.

jared_c’s picture

That's right, I did do the "stable then dev" install cycle.

I dropped both tables from the MySQL database. When I go and reinstall it doesn't create new tables. As long as installation only requires copying to the .../modules directory and enabling it in the admin/build/modules page then something's going on with the install script. Or maybe I don't know how to install this right.

Does this look like a install script issue or user error issue to you?

Jared

BlakeLucchesi’s picture

Status: Active » Fixed

I apologize, for some reason an old copy of the install file got put in the dev snapshot. I fixed the errors, and it should now install without problems, I tried it on three different sites. When the new dev snapshot publishes you will be able to download the package with the fixed install file.

To make sure it runs properly, uncheck the module to disable it, then click on the uninstall tab at the top of the modules page, uninstall the fuzzy search module, and then go back and check to activate it. This will ensure that the tables are created. Once you have done that you can activate the "Fuzzy search form" block to place a search form on your site, and make sure to run your cron.php script to do the first round of indexing.

Sorry again for the early errors.

jared_c’s picture

Just wanted to update this and say that the patch worked great.

Thanks for the prompt response.

Jared

jared_c’s picture

Status: Fixed » Closed (fixed)