Closed (fixed)
Project:
Search API
Version:
7.x-1.x-dev
Component:
Framework
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Sep 2011 at 10:11 UTC
Updated:
4 Jan 2014 at 01:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mhh commentedOk, I found the reason for this error.
When you enable the Node Access alteration in the workflow tab in the Search Index settings, you also have to enable »Published« in the fields tab.
Maybe it is possible to implement some functionality, that enables the Published option automatically as soon as the Node Access alteration is enabled.
Comment #2
drunken monkeyAh, of course! Sorry, was silly to overlook that. I don't have time to look into this right now, but will think of a way to alleviate this through some notes, or even fix it automatically as you say.
Comment #3
dawehnerOne way to do it would be perhaps to set $index->options['fields']['status'] = 1 on configurationFormSubmit.
Does this make sense?
Comment #4
drunken monkeyYeah, it would probably be the best solution. The thing is hard-coded for nodes anyways, so some additional customizations don't matter, I guess. (The last key is 'indexed', not 'status', though.)
And we should also append this to the notes saying that you have to have the „Node access information“ field indexed for this to work, and likewise add it to the corresponding checks in the query alter hook.
(Oh, and fix the watchdog constant on line 1264 of search_api.module – oops!)
Comment #5
dawehnerAssign to myself, hopefully i will find time tonight.
Comment #6
dawehnerOkay here is a short patch which automatically alters the index.
Did i already said that i like the clean-code of searchapi ?
Comment #7
drunken monkeyThis goes in the right direction, but fails to check whether the Node access data alteration was enabled. Like it is, this will set the „Published“ field to „indexed“ every time the „Workflow“ form is submitted.
You'll additionally have to check whether the data alteration was previously disabled but now enabled in the form – only in this case do we automatically set the fields added by the data alteration to „indexed“ as well.
Comment #8
dawehnerThis seems to make sense, what about this patch?
Comment #9
drunken monkeyYes, quite good. However, we should also check if the field is enabled when altering the query, or the exception might still occur. Patch attached.
Comment #10
drunken monkeyComment #11
drunken monkeyComment #12
dawehnerPlease look at your patch, sure it's helpful but it doubt it can work like this ;)
Comment #13
drunken monkey:-/
Comment #14
dawehnerHere is a slighly small change with renames $f to $fields because that's a bit easier to understand.
The last change you made looks fine!
Comment #15
drunken monkeyOK, just chose
$fso the line wouldn't be so awefully long, but I guess that's not really helping readability.Anyways, looks good to me! Anyone else want to test/review?
Comment #16
drunken monkeyOK, committed. Thanks again for you help, Daniel!