I have various nodes set with Domain Source to their own domains. But Drupal search returns all nodes as udner the parent node. See for yourself at http://id.ucsb.edu
help please? I can send screenshots if requested.
I have various nodes set with Domain Source to their own domains. But Drupal search returns all nodes as udner the parent node. See for yourself at http://id.ucsb.edu
help please? I can send screenshots if requested.
Comments
Comment #1
agentrickardDomain Source does not control this behavior. Domain Source only controls where the link points to. If a node is assigned to "all affiliates" or you have changed the search settings to " Search all domains from any URL", then the node will appear in search results. (This will also happen if you are user 1 or have the 'administer nodes' permission.)
You can use Devel module's Devel Node Access module to debug this behavior.
Comment #2
dgurba commentedThank you for your reply and time. As I am hoping to migrate soon to DA 2.0 I want to be sure I don't need my homegrown fix below.
On these site(s) a node is assigned via Domain Source to belong to typically a single domain. But in the search results page every node is only linked to the domain with domain_id = 0
But is the source of the domain respected? Or will it merely "show up in the list -- for the current domain you are visiting?" That appeared to be the behavior.
I will do that.
Additionally -- since I need a "quick fix" to this. I derived the below function on Sunday night. My question is should DA provide this functionality through a configuration setting that I may have missed? I have this option enabled in DA admin configuration: "Search all domains from any URL"
Thanks again I find this module very useful.
Comment #3
agentrickardYou are misunderstanding the documentation. The module is working normally and you don't need to do anything. You do not need custom code.
Here's the rundown.
1)
I have this option enabled in DA admin configuration: "Search all domains from any URL"This option means that _all_ content assigned to _any_ domain always appears in search results. That is, the search results behave as if the module's node access rules were disabled. If you do not want this behavior, turn it off. (It is off by default.)
If you turn this off, search will behave as you describe, with only nodes assigned to the current domain displayed.
2) Domain Source does not control visibility. Domain Source controls the link that is written if a node appears on a domain other than its 'canonical' domain. The Domain Source module is for cases like search, where you want to show content from all domains, but also want to control which domain the result links to. (Without Domain Source, the module will link to the first matching domain id record it finds.)
Domain visibility is set by the core module, using the Affiliate checkboxes.
Everything is working as designed, please read the documentation for Domain Source, especially section 3.
Comment #4
BarisW commentedI have "Search all domains from any URL" disabled, but search still ignores the domain settings. It returns all nodes found, from all domains. I searched anonymously (not logged in).
What could this be?
Comment #5
agentrickardIf the nodes are assigned to 'all affiliates', they will be returned. If your anonymous user has 'administer nodes' -- which would be odd and a huge security issue -- they can always see all content. If the anon user created the content, they can see the content.
If you are using search other than Drupal's core, it might not be applying node access rules properly.
Works as designed.
Comment #6
BarisW commentedThanks for your reply!
I think the problem is that my article nodes weren't attached to an userid, because they were imported using a custom script. I assigned a user to all nodes in mysql but to no avail.
Comment #7
BarisW commentedI managed to solve it!
I reset all Access Permissions using this checklist. That did the trick!
Hope this helps other users.
Comment #8
agentrickardI just realized this week that when you import nodes, it doesn't matter what you set $node->uid to. You have to set $node->name, because node_save() does a username lookup, not a UID lookup. Weird, huh?
Comment #9
BarisW commentedMaybe that's why all uid's are 0, I assigned node->uid = 0.
I also found another problem: we use the Search Config module, and by doing so all nodes are returned. Is this a Domain Access issue or a Search Config issue?
Comment #10
agentrickardI would assume Search Config. I am looking at the function
search_config_db_rewrite_sql(), which may be shutting out node access queries.Try commenting that out and test again.
Comment #11
BarisW commentedHi,
you were right. Search Config is using a pretty nasty hack to filter out specific Content Types from the search index.
Be deselecting all Content Types on the Advanced Search Config page our search is working as expected!
Thanx for your help :)
Comment #12
agentrickardYou need to report that to the module author and possibly the security team. Bypassing node access is bad.
Comment #13
BarisW commentedReported. Tnx!