The background:
I'm working on content_permissions integration. When the anonymous user no longer has access to CCK fields, they don't get indexed in any way. Prior to the change in the indexing, CCK text fields would always get smooshed into the the $node->body at index time. Now we need a way to get these CCK fields into the index as their own field so that we can execute searches on them and respect the proper privileges. As it stands, we have the infrastructure for indexing CCK fields. The current limitation, however, is that we only do so for purposes of faceting. This means two things. First, we need a way to index CCK fields as text (so they can be searched on), and we need a way to say that we're NOT trying to facet on these fields.
My proposed solution adds a 'facets' key to the CCK field definitions array, which takes a TRUE or FALSE. This is used to determine whether facets should be built on that field. I then make it possible to have a 'default' CCK field definition for a field type, and for CCK text fields, I use the 'default' definition to index the field as text and mark it as as 'facets' = FALSE. This sets the stage perfectly for a new module to come along and do searches on these fields while respecting content_permissions perms.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 899590-14-6-1.patch | 5.55 KB | elliotttf |
| #14 | 899590-14-6-2.patch | 3.19 KB | elliotttf |
| #14 | 899590-14-7-1.patch | 5 KB | elliotttf |
| #11 | 899590-11-6-1.patch | 4.46 KB | jpmckinney |
| #11 | 899590-11-6-2.patch | 1.31 KB | jpmckinney |
Comments
Comment #1
robertdouglass commentedTalked to Peter, confirmed the approach. One change in this patch is that the actual 'default' definition for text fields won't come in the patch, but will rather be modified into $mappings in a module that you turn on specifically to ensure content_permissions compatibility. So that has been taken out of the patch. Everything else is essentially the same. Committing to 6.2. Marking to be ported for 6.1 consideration.
Comment #2
robertdouglass commented#899590 by robertDouglass: Changed CCK facet definitions needs to expand its role and have a 'facets' param.
Comment #3
pwolanin commentedI don't see that this made it into 7.x either. This does seem pretty useful to have to avoid a confusing admin UI.
Comment #4
jpmckinney commentedAttaching a patch that ignores whitespace to make it easier to review.
We may have missed one in 6.x-2.x
Comment #5
pwolanin commentedLooking just at 6.x-1.x for the moment. Basically looks good, but possibly we want to make TRUE the default to make things nicer in terms of BC? At the least, we should either set a default or change this:
to something like:
to avoid notices about variables that are not set.
Comment #6
jpmckinney commented+1 to !empty. To make "facet" => "TRUE" the default, wouldn't we have to instead make the key "nofacets" => FALSE? That way empty($field['nofacets']) will succeed on all existing fields.
Comment #7
pwolanin commentedI meant we could set a default value. See attached.
Comment #8
jpmckinney commentedYes, and I don't think that works. In 7.x, you simple don't set 'facets' if you don't want it. No 'facets' key is the same as 'facets' => FALSE.
With that patch, you must set 'facets' => FALSE, otherwise it defaults to TRUE, which is not what you expect. No 'facets' key becomes the same as 'facets' => TRUE.
I'd rather have the same behavior in both.
Comment #9
pwolanin commentedI think it's worth having different behavior in 6.x-1.x otherwise the upgrade will break people's custom cck mappings, so indeed that will have to specifically set 'facets' to FALSE.
We can make it default to TRUE in all branches (or flip the logic to 'nofacets') if you prefer consistency. I don't have a strong feeling as long as for 6.x-1.x an existing implementation would continue to work the same.
Comment #10
jpmckinney commentedOkay, let's go with setting a default in 6.x-1.x. We aren't trying to keep 6.x-1.x and 7.x in sync anyhow.
Comment #11
jpmckinney commentedFor 6.1, do we need these lines from the 6.2 patch in #1:
Brought 6.1 patch more in line with patch in #1 (without adding the above, though). Fixed 6.2 and 7.1 patches to use !empty.
Comment #12
elliotttf commentedShould the comments and readme file about cck field definitions be updated to include this field?
i.e.:
and
Other than that the patch looks good to me.
Comment #13
jpmckinney commentedMind rolling a patch with those changes?
Comment #14
elliotttf commentedDone.
Comment #15
pwolanin commentedI haven't tested per-se but visual review looks like these are ready to commit.
Comment #16
pwolanin commentedcommitted all - though included another patch together with the 7.x one by accident.
Comment #17
jpmckinney commentedJust to note: #1107502: Merge relevant parts of php client into DrupalApacheSolrService is the referenced patch.
Comment #18
scor commentedWhy was the drush command solr-phpclient removed with this commit?
Comment #19
jpmckinney commentedWe no longer require you to download the phpclient.
Comment #20
pwolanin commented@scor - see #16 - I committed 2 patches together by mistake.