Suchscript für Mehrere MySQL Tabellen

Sandro Feuillet

Legendäres Mitglied
Ich habe mit DGSSearch ein Script gefunden, welches genau bietet was ich suche. Leider komme ich mit der Konfiguration nicht klar, vielleicht kann mir hier jemand helfen:

Ich habe ein Blog und ein Forum ( :) ) leider kann ich nicht alles aufs mal durchsuchen, genau das sollte das Script machen:

Die Vier Tabellen nach Stichwörtern durchsuchen, vernünftig ranken (inkl. fuzzysearch) und eine Resultatseite ausspucken. Doch leider bleibe ich in der Konfiguration hängen, ich verstehe folgende Passage in der Anleitung zur Konfiguration nicht:

QUOTE
$database[x]["tableAssoc"] - Datatype: (String) - Ex: "article.magazineid = magazine.magazineid"

A string of rules for associating the records in multiple tables. If you
are only searching one table, set this value to the empty string.

If you had the SQL statement:

SELECT * FROM article, magazine WHERE article.magazineid = magazine.magazineid;

The "tableAssoc" is used to build the "article.magazineid = magazine.magazineid" section
of that statement.


$database[x]["returnField"] - Datatype: (Array of String) - Ex: array("author", "title", "mag_name", "articleid")

The fields returned from the database. These fields can be used to substitute
into the URL and description. The fields are referred to in the same order
they are listed within the array, starting from 0. The first field 'author'
would be referred to as '@0@'. The second field 'title' would be referred to as
@1@. The third field 'mag_name' would be '@2@', etc.

If you had the SQL statement:

SELECT author, title, mag_name, articleid FROM table WHERE articleid = 1;

The "returnField" array is used to build the "author, title, mag_name, articleid"
section of that statement. It determines what data from the database you can use to
build your "link", "url" and "desc" on the results page.


$database[x]["searchField"] - Datatype: (Array of String) - Ex: array("title")

The field(s) to search within your table. These are the fields DGS Search will search to
locate results.

If you had the SQL statement:

SELECT articleid, title FROM table WHERE title = "Rings";

The "searchField" array is used to build the "title = Rings" section of that statement.



Bei mir sieht das so aus.


CODE
$database[0]['table'] = array(' minibbtable_posts',' minibbtable_topics',' wp_posts',' wp_comments'); /* The table in database to search. */

$database[0]['tableAssoc'] = ''; /* If multiple tables listed, is used to join the tables. See INSTALL. */

$database[0]['searchField'] = array('title', 'artist'); /* The fields to search. */



Ich verstehe nicht, wie ich die Tabellen joinen muss?? gmpf
 
Hallo

So wie ich das lese sind die Tables im array
$database[0]['table'] = array(' minibbtable_posts',' minibbtable_topics',' wp_posts',' wp_comments');
alle in einer Abfrage:
SELECT * FROM article, magazine WHERE article.magazineid = magazine.magazineid;
Hier wäre es das array(article,magazine)

Das entsprechende array
$database[0]['tableAssoc'] = array('article.magazineid','magazine.magazineid');

oder da die Tabellenname ja bereits im anderen array gespeichert sind:
$database[0]['tableAssoc'] = array('magazineid','magazineid');

Gruss

Tümmel

 
Zurück
Oben