This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

boolean operations in site search & taxonomy?

Am I being thick, or is it true that the standard boolean search operators (at least I think that's what they're called) are not supported by the drupal site-search box?

The kind of operations I mean are:
"search for whole phrase"
search+for+all+terms (usually default)
search,for,any,of,these,terms
-filter -out -these -terms
(combine)+(operators -junk)
etc etc - my apologies if I've used the wrong operator characters, I'm just used to using the common search engine defaults ...

and while I'm at it:

db_set_active acting strangely

In settings I have:

$db_url['default'] = 'mysql://aaa';
$db_url['depletion'] = 'mysql://bbb';

In my custom module I have:

db_set_active('depletion');
.
.
.
db_set_active('default');

Even with nothing but commented out lines between them, I get the following error:

user error: Table 'local_aspo.blocks' doesn't exist
query: SELECT * FROM blocks WHERE status = 1 AND region = 0 ORDER BY weight, module in /.[snip]./database.mysql.inc on line 66.

I've tried removing the word 'default' from the 'default' db_set_active which makes no change.

BUT... when I change it to:
db_set_active('anything-else-but-default-or-depletion');

... it bizarrely works!

I'm using a two-day old 4.6RC. db_set_active is:

function db_set_active($name = 'default') {
global $db_url, $db_type, $active_db;
static $db_conns;

if (!isset($db_conns[$name])) {
// Initiate a new connection, using the named DB URL specified.
if (is_array($db_url)) {
$connect_url = array_key_exists($name, $db_url) ? $db_url[$name] : $db_url['default'];
}
else {
$connect_url = $db_url;
}

$db_type = substr($connect_url, 0, strpos($connect_url, '://'));
$handler = "includes/database.$db_type.inc";

if (is_file($handler)) {
include_once($handler);
}
else {
die('Unsupported database type');

Searching Custom Module Pages (not nodes)

I'm making a custom module which connects to a non-drupal database to display a page per country. e.g.:
/countries - shows a listing of countries
/countries/england - shows a page for england
/countries/ireland - shows a page for ireland

Creating a New Node Type

Hello, I'm almost finished with node_example.module, I've learned a lot from it and I'm almost ready to start creating my own node types.

If I have understood correctly I use the node table to maintain common fields and create a new table, node_example, which will contain the additional fields of my new node type, this new table should include a nid field to be able to join to the main node table, am I correct?

I have two observations:

1. I modified node_example_validate() to use form_set_error()

Understanding node_example_link

Hello, I studying node_example.module in order to create my own node types. I know there is flexinode but I want to learn how this works.

I have a doubt in the Implementation of hook_link(), here is the code:

Is there no function to return all the nodes for a taxonomy term?

I want to be able to recover all the nodes attached to a tid. I'm thinking of a function which might be called "taxonomy_get_nodes" for example, but cannot find it anywhere. I have found a "taxonomy_select_nodes", but this only returns a limited amount of information (I really want the nid and the title).

Similarly, a function which would simply return all the properties of a node would be very nice: eg "node_get_attributes"

I have spent ages looking through the documentation but with no success...

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions