I've installed Fuzzysearch with all the required modules, and I'm using Search API Pages to display the search page.
Doing a test search, actually searching for the word "test" (because we have a page about "testing" dates and locations, and I want to see if it'll correctly pick up part of the word, I get the following errors/warnings:
Notice: Undefined variable: clean_grams in fuzzysearch_build_excerpt() (line 221 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_map(): Argument #2 should be an array in fuzzysearch_unique() (line 443 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_unique() expects parameter 1 to be array, null given in fuzzysearch_unique() (line 443 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_map(): Argument #2 should be an array in fuzzysearch_unique() (line 443 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: Invalid argument supplied for foreach() in fuzzysearch_unique() (line 445 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: Invalid argument supplied for foreach() in fuzzysearch_process_excerpt() (line 274 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Notice: Undefined variable: clean_grams in fuzzysearch_build_excerpt() (line 221 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_map(): Argument #2 should be an array in fuzzysearch_unique() (line 443 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_unique() expects parameter 1 to be array, null given in fuzzysearch_unique() (line 443 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_map(): Argument #2 should be an array in fuzzysearch_unique() (line 443 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: Invalid argument supplied for foreach() in fuzzysearch_unique() (line 445 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: Invalid argument supplied for foreach() in fuzzysearch_process_excerpt() (line 274 of /var/httpd/drupal7-base.viedu.org/drupal-7.12/sites/all/modules/fuzzysearch/fuzzysearch.module).
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | fuzzysearch.module.patch | 421 bytes | kunago |
Comments
Comment #1
gecko85 commentedRemoved because it didn't directly relate to this issue...
Comment #2
awolfey commentedPlease file a second support request for the question in #1, and check that your content is fully indexed and that you're indexing whatever creates the page about tutoring. Thanks.
Comment #3
gecko85 commentedOk, I'll file a second support request.
To answer your other questions: I've fully indexed (and re-indexed, and run cron) to no avail.
Regarding the errors/warnings: they occur no matter what I'm searching for, but sometimes there are fewer warnings, sometimes there are more. They're always similar, though, having to do with lines 221, 443, and 445.
Are these serious, or because warnings will be turned off on the production site, should I just ignore them?
Comment #4
Tony Finlay commentedI'm having exactly the same issue
Comment #5
awolfey commentedI'm unable to duplicate. In a new minimal drupal install I used the default fuzzysearch index and server. I generated 50 nodes with devel generate. I created a search_api page for searching. I'm using the current dev of fuzzy search and search_api 1.0. I'm using all the default settings. I did have to save the index fields settings as is in the default for an unrelated bug.
Any chance you can start with a fresh install and try it?
When generating the search excerpt for each matched entity, fuzzysearch reruns a clone of the search query to check for ngrams in that particular entity. From the looks of your errors, it appears that the excerpt query on line 209 isn't returning what is expected.
A search for the word apto created a $clean_grams array like this http://gyazo.com/1fa937a297cd605d62e5319d330400a0
If you could see what you have in your $clean_grams array that may help. Thanks.
Comment #6
pixelsweatshop commentedAfter receiving these errors on one of my sites, I went to work trying to replicate the issue. After messing around for an hour, I think I finally got it.
1. Standard Core Install
2. Install latest Dev of Fuzzy Search, Search API 1.0 and Search API Pages 1.0-beta2
3. Go to /admin/config/search/search_api/index/default_fuzzysearch_index/workflow
4. Enable Bundle Filter
5. checkoff 'All but those from one of the selected bundles' and select basic page
6. Enable "node access'
7. The following the recommendation of http://drupal.org/node/1414138#comment-5547094 (which is mentioned by awolfy in http://drupal.org/node/1479566#comment-5809246 as a workaround)
8. Create a Search page
9. Generate some content with Devel
10. Re-index
11. Run a search
It appears once this has been done, you can't back out of it. (i.e. can't just remove the 'node access' and 'bundle filter' and reindex. It still throws up these errors.
I hope this helps you to replicate this awolfy. Let me know if you still can't replicate the issue
Comment #7
murzGot the same issue with Dev of Fuzzy Search, Search API 1.0 and Search API Pages 1.0-beta2
Comment #8
kay.beissert commentedI got the same issue with Dev of Fuzzy Search, Search API 1.0 and using Views for a Site-Search-Page. The Errors appear only if I search for a part of a word. The search gives me a result (sometimes with text extraction sometimes only the title of the text) and these errors appear:
Notice: Undefined variable: clean_grams in fuzzysearch_build_excerpt() (Zeile 221 von /is/htdocs/wp11011745_D6ORBK4BRJ/www/.adm-tube.de/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_map() [function.array-map]: Argument #2 should be an array in fuzzysearch_unique() (Zeile 443 von /is/htdocs/wp11011745_D6ORBK4BRJ/www/.adm-tube.de/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_unique() expects parameter 1 to be array, null given in fuzzysearch_unique() (Zeile 443 von /is/htdocs/wp11011745_D6ORBK4BRJ/www/.adm-tube.de/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: array_map() [function.array-map]: Argument #2 should be an array in fuzzysearch_unique() (Zeile 443 von /is/htdocs/wp11011745_D6ORBK4BRJ/www/.adm-tube.de/sites/all/modules/fuzzysearch/fuzzysearch.module).
Warning: Invalid argument supplied for foreach() in fuzzysearch_unique() (Zeile 445 von /is/htdocs/wp11011745_D6ORBK4BRJ/www/.adm-tube.de/sites/all/modules/fuzzysearch/fuzzysearch.module).
Comment #9
kunago commentedAs I understand it, the variable $clean_grams is there to store fetched ngrams from the database based on the user input.
In case the search is able to indetify some ngrams in the dabatase, it populates the variable (array in this case).
If there is nothing found, however, the variable is not populated, in fact it is not declared at all.
What fixed the issue for me was simply declarating it.
In the function "fuzzysearch_build_excerpt" declare the variable with "$clean_grams = array();". That did the trick for me.
Comment #10
adamgerthel commentedthanks for the patch. Fixed the problem for me
Comment #11
rbosscher commented#9 fixed it for me too
Comment #12
tengoku#9 works for me also
Comment #13
esvcg commentedopen file
modules/fuzzysearch/includes/service.inc
find lines 656/657:
// See @todo below
$results['result count'] = $count_query->execute()->fetchField();
overwrite with:
//------start of cheap fix------
//search used to crash on 1 and 2 character searches
if ( (@strlen($keys) > 2) )
{ $results['result count'] = $count_query->execute()->fetchField(); }
else
{ $results['result count'] = @$results['result count']; }
//------end of cheap fix------
a dirty fix, but does the job
Comment #14
awolfey commentedCommitted patch from #9. Thanks kunago and everyone!