When fac fetches the json files it seems it does not take the subdirecory into account in which drupal is installed. This is indicated by the 404 messages I can see printed on the js-console. The URLs in these messages do not contain the subdir.

Additionaly when I run drush -d cron I see lots of

Undefined index: items fac.module:305 [61.63 sec, 45.59 MB] [notice]
Invalid argument supplied for foreach() fac.module:305 [61.63 sec, 45.59 MB] [warning]

(not sure if it's related though).

Comments

guidot created an issue. See original summary.

guidot’s picture

Issue summary: View changes
guidot’s picture

Status: Active » Needs review
StatusFileSize
new505 bytes

I'm not sure if that's the way to go, but removing the leading slash in line 249 in jquery.fastautocomplete.js solved the problem here. See attached patch.

Status: Needs review » Needs work

The last submitted patch, 3: respect-subdir-2699917-3.patch, failed testing.

guidot’s picture

Ok, the patch was against 2.1, maybe it should be against latest dev?
Anyway, there seem to be more places that need attention: When I select a result the URL opened also misses the subdir.

marty2081’s picture

StatusFileSize
new2.28 KB

We should use base_path() to determine the proper path for the JSON files. Can you try the attached patch on the dev version to see if this fixes the subfolder issue?

When you select a result, the JS takes the first anchor in the result it can find and opens the href of that anchor. So if the URL you end up at is not correct, that's in the output of the result view mode / field output. That is not something the module generates and you should check your view mode/field output.

marty2081’s picture

Status: Needs work » Needs review
marty2081’s picture

PS: the notice is not related, but fixed in the patch as well.

Status: Needs review » Needs work

The last submitted patch, 6: fac-base_path_fix-2699917-6.patch, failed testing.

guidot’s picture

Sorry for the delay and thanks Martijn for looking into this.

As you already integrated this patch into current dev I just tried that. I tried two backends, the built-in basic title search service and the search api search service.

  • In both cases the URLs are missing the subdir. I have no idea where to configure that differently.
  • Pre-genereted json-files are beeing found.
  • No new files are beeing generated.
  • Something else has to be wrong with the file-generation: They contain hits to nodes that don't even contain the corresponding letter(s).
firewaller’s picture

I've gone ahead and created a separate issue/patch here for the following errors:

Notice: Undefined index: items in fac_generate_json_for_key() (line 305 of /sites/all/modules/contrib/fac/fac.module).
Warning: Invalid argument supplied for foreach() in fac_generate_json_for_key() (line 305 of /sites/all/modules/contrib/fac/fac.module).