Author Topic: [Tutorial] Making additional field searchable  (Read 179004 times)

0 Members and 1 Guest are viewing this topic.

Offline hinzwiekunz

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.hinzwiekunz.de
Re: [Tutorial] Making additional field searchable
« Reply #45 on: September 01, 2005, 12:19:10 AM »
Hi Jan,
thanks for your answer. I tried, but it dont work. It dont find my images with this values.
For me its important to have the choice to search for images with this new image_license-value "0" and images with value "1" in combination with the keywords.
I tried again like Vano:
Code: [Select]
<input type="radio" name="search_fields" value="image_license_yes" /><br><input type="radio" name="search_fields" value="image_license_no" />But there is no changing.

In Deutsch.
Vielen Dank noch mal, Jan. Es hat allerdings noch nicht geklappt. Auch so finde ich mit der Suche nicht die Bilder mit den ensptrechenden Werten.
Ich möchte nach Lizenzfreien und Lizensierten in der Suche unterscheiden können und diese Bildeigenart, eigentlich nach Bedarf zuschalten können - deswegen dachte ich den radio-namen anders zu wählen. Eine Kopplung an die anderen search_fields ist ok, aber es funkioniert auch so nicht. Auf jedenfall wäre mir wichtig nach image_license_yes und _no als Button zu unterscheiden. Vano hatte das auch ähnlich vorgeschlagen.
Es funkionert nur alles nicht, obwohl die einzelnen Bilder schon wunderbar eingestellt und bearbeitet werden können. Ich habe drei Test-Bilder mit dem Keyword test versehen. Ein Bild ist lizenzfrei, zwei andere sind mit dem Keyword "test" lizensiert. Super klappt die unterschiedliche Darstellung von Informationen jeweils bei lizensierten und lizenzfreien Bildern.

Code: [Select]
{if image_license}<strong>Lizensiert</strong><br>                              <table width="100%"  border="0" cellpadding="0" cellspacing="4">
                                <tr>
                                  <td class="title">&nbsp;</td>
                                  <td valign="top">F&uuml;r eine Verwendung dieses Bildes machen wir Ihnen ein konkretes Angebot. Bitte klicken Sie auf den Anfragebutton und f&uuml;llen das Formular aus. </td>
                                  <td align="right" valign="top"><span class="rowsearch"><a href="index.php?template=preise">{hilfe_button}</a></span></td>
                                </tr>
                                <tr>
                                  <td class="title"><img src="{template_url}/images/spacer.gif" alt="" width="25" height="5" /></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                <tr>
                                  <td class="title">&nbsp;</td>
                                  <td><a href="http://www.hinzwiekunz.de/gallerytest/anfrage.php?cat_id={cat_id}&image_file_name={image_file_name}" target="Anfrage" onClick="MM_openBrWindow('anfrage.php','Anfrage','toolbar=yes,scrollbars=yes,resizable=yes,width=530,height=630')">{anfrage_button}</a></td>
                                  <td>&nbsp;</td>
                                </tr>
                              </table>                             
                              {endif image_license}{ifno image_license}<strong>Lizenzfrei
                              </strong><br>                              <table width="100%"  border="0" cellpadding="0" cellspacing="4">
                                <tr>
                                  <td class="title"><img src="{template_url}/images/spacer.gif" alt="" width="25" height="5" /></td>
                                  <td valign="top">Dieses Bild ist lizenzfrei zu folgenden Preisen zu erwerben.</td>
                                  <td align="right" valign="top"><span class="rowsearch"><a href="index.php?template=preise">{hilfe_button}</a></span></td>
                                </tr>
                                <tr>
                                  <td class="title">&nbsp;</td>
                                  <td><table  border="0" cellpadding="0">
                                    <tr>
                                      <td><p>&nbsp;</p></td>
                                      <td>&nbsp;</td>
                                      <td>&nbsp;</td>
                                      <td>&nbsp;</td>
                                      <td>&nbsp;</td>
                                    </tr>
                                    <tr>
                                      <td class="title">Web</td>
                                      <td><img src="{template_url}/images/spacer.gif" alt="" width="25" height="5" /></td>
                                      <td>900 x 600 Pixel bei 72 dpi</td>
                                      <td><img src="{template_url}/images/spacer.gif" alt="" width="25" height="5" /></td>
                                      <td>40 &euro;</td>
                                    </tr>
                                    <tr>
                                      <td class="title">A5</td>
                                      <td>&nbsp;</td>
                                      <td>ca. A5-Format bei 300 dpi</td>
                                      <td>&nbsp;</td>
                                      <td>90 &euro; </td>
                                    </tr>
                                    <tr>
                                      <td class="title">A4</td>
                                      <td>&nbsp;</td>
                                      <td>ca. A4-Format bei 300 dpi</td>
                                      <td>&nbsp;</td>
                                      <td>120 &euro;</td>
                                    </tr>
                                    <tr>
                                      <td class="title">A3</td>
                                      <td>&nbsp;</td>
                                      <td>ca. A3-Format bei 300 dpi</td>
                                      <td>&nbsp;</td>
                                      <td>180 &euro;</td>
                                    </tr>
                                  </table></td>
                                  <td>&nbsp;</td>
                                </tr>
                                <tr>
                                  <td class="title"><img src="{template_url}/images/spacer.gif" alt="" width="25" height="5" /></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                <tr>
                                  <td class="title">&nbsp;</td>
                                  <td><a href="http://www.hinzwiekunz.de/gallerytest/bestellen.php?cat_id={cat_id}&image_file_name={image_file_name}" target="Bestellung" onClick="MM_openBrWindow('bestellen.php','Bestellen','toolbar=yes,scrollbars=yes,resizable=yes,width=530,height=630')">{bestellen_button}</a></td>
                                  <td>&nbsp;</td>
                                </tr>
                              </table>

??????

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Tutorial] Making additional field searchable
« Reply #46 on: September 02, 2005, 04:47:18 PM »
Nee, ich glaube Du hast das Prinzip noch nicht verstanden ;) Nicht böse gemeint :)
Hab leider momentan keine Zeit das zu programmieren. Evtl. bekommst Du es alleine raus indem Du Dich in search.php und global.php an $search_new_images orientierst.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline hinzwiekunz

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.hinzwiekunz.de
Re: [Tutorial] Making additional field searchable
« Reply #47 on: September 06, 2005, 12:38:45 AM »
Hi Jan,
du hast recht. Wie das alles in 4images miteinander verknüpft ist bei der suche verstehe ich nicht so richtig. Ich hatte es mir nicht so schwierig vorgestellt. Danke für die Tips, aber ich steige da nicht so richtig durch...
Ich habe jetzt erst alles umgestellt ohne Suche, wäre aber SEHR daran interessiert, bald die Suche zu ermöglichen...  :roll:

Gruß,
Markus

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Tutorial] Making additional field searchable
« Reply #48 on: September 25, 2005, 09:15:58 AM »
Hi,
habe meine Suche jetzt erweitert
Nur wenn im Suchwort jetzt ein - enthalten ist, findet er dieses Bild nicht.

Bei uns gibt es aber BPZ Nummern, die ein - enthalten z.B. S-1 oder auch Serien Namen mit _ oder auch Piratelli - Käpt´n Knautsch

wäre schön wenn ihr mir da einen Tip geben könntet

Ansonsten klappt alles Super

gruss Harald

Ps. habe ein Test Bild erstellt
http://www.mr-marker.de/4images/details.php?image_id=10714

Edit: habe jetzt rausgefunden das die Suche bei z.B. S-1 nicht klappt, aber bei C-107 klappt es bestens.
Kann es sein das zur suche mehr als 3 Einträge nötig sind ?
hat also nichts mit dem minus Zeichen zu tun das es nicht geht.
und wenn ja, kann man dieses ändern?


gruss Harald


Danke Harald




Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Tutorial] Making additional field searchable
« Reply #49 on: September 26, 2005, 04:30:50 PM »
Siehe includes/constants.php

Code: [Select]
define('MIN_SEARCH_KEYWORD_LENGTH', 3);
Das "-" wird nicht als Zeichen gewertet und ausgefiltert.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Tutorial] Making additional field searchable
« Reply #50 on: September 28, 2005, 01:03:57 AM »
Hi Jan,
Danke,
Aber habe es auf 2 gestellt, und will immer noch nicht gefunden werden  :cry:
vielleicht noch eine Stelle im Skript ?

gruss Harald

Edit: Sorry mein Fehler, hatte das Testbild wieder gelöscht  :wink:
Danke
Danke Harald




Offline hinzwiekunz

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.hinzwiekunz.de
Re: [Tutorial] Making additional field searchable
« Reply #51 on: September 30, 2005, 05:43:27 PM »
Nee, ich glaube Du hast das Prinzip noch nicht verstanden ;) Nicht böse gemeint :)
Hab leider momentan keine Zeit das zu programmieren. Evtl. bekommst Du es alleine raus indem Du Dich in search.php und global.php an $search_new_images orientierst.


Hallo Jan,

nach Urlaub - muss ich nun wieder ran ans Formular. Hier eine Beispielseite, wie ich mir das vorgestellt hatte mit den voneinander getrennten Suchmöglichkeiten. Super gelöst... Ich habs so noch nicht gepackt.
Gruß,
markus

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [Tutorial] Making additional field searchable
« Reply #52 on: February 10, 2006, 11:02:05 AM »
I followed the thread, i have a small question.

For example i make the "user_sex" and "user_location" field from the GIS MOD searchable, how do i make that field in the search with radiobuttons.

For example, seaarch usergender - o male / o female


?

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #53 on: October 09, 2006, 02:53:50 AM »
I'm using dreamboard ,and i would know how make the search form search for results at board, how added:

Table: 4images_boardtind  => thrtopic

Or if this isnt possible, a external script to search at this specific table  :oops:

Offline Hein

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #54 on: October 24, 2006, 12:26:33 PM »
Nothing, i did it wrong ;)

Use:

Code: [Select]
WHERE ".get_user_table_field("", "user_name")." LIKE '$search_user' OR user_vorname LIKE '$search_user' OR  user_name2 LIKE '$search_user'";

Hallo,

ich nutze diesen Tip von Jan in abgewandelter Form für meine Memberlist, speziell für eine Usergroup. Nun funktioniert die Suchfunktion nach Mitgliedern schon mit 3 verschiedenen Feldern:

[qcode]$condition = " AND ".$additional_sql." u.user_nachname LIKE '".addslashes($filter_db)."' OR
".$additional_sql." u.user_vorname LIKE '".addslashes($filter_db)."' OR
".$additional_sql." u.user_artistname LIKE '".addslashes($filter_db)."'";
[/qcode]

Allerdings wird bei den zwei zusätzlichen Feldern mit der OR-Funktion, die group_id nicht berücksichtigt und somit werden als Suchergebnis auch Mitglieder anderer Usergruppen ungewollt mit angezeigt. Bei der Suche nach user_nachname in der AND-Bedingung klappt alles wie gewollt!

Wie bekomme ich trotz der OR Funktion das Probleme gelöst?

Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Hallo!

Ich möchte in nächster Zeit von PHP 4.4.7 auf PHP 5 umsteigen.
Die 4images Galerie läuft auf PHP 4.4.7 & gemieteten Linux-Server perfekt ohne Fehler.

Jetzt habe ich meine Galerie auf PHP 5 einmal testen wollen. Dazu nahm ich das Tool 4images Mobile Server mit PHP 5.2.3.
Leider kommen ab jetzt immer die folgenden Fehler:

Code: [Select]
DB Error: Bad SQL Query: REPLACE INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match, gmap_match) VALUES (6, 122, 1, 1, 1), (6, 115, 0, 0, 1), (6, 134, 0, 0, 1), (6, 132, 0, 0, 1)
Column count doesn't match value count at row 1
Bild erfolgreich bearbeitet
oder ein anderes Beispiel:
Code: [Select]
DB Error: Bad SQL Query: REPLACE INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match, gmap_match) VALUES (6, 8, 1, 0, 1), (6, 9, 0, 0, 1)
Column count doesn't match value count at row 1

Diese Fehler kommen beim Uploaden von Bildern immer, beim Bearbeiten von Bildern (admin/images.php) nur manchmal.

Ich habe alles nach den folgenden Anleitungen gemacht:
- Google-Maps Integration V.01  http://www.4homepages.de/forum/index.php?topic=16533.0
- Making additional field searchable  http://www.4homepages.de/forum/index.php?topic=1313.msg5562#msg5562

in includes/constants.php
Code: [Select]
define('MIN_SEARCH_KEYWORD_LENGTH', 3);  ersetzt durch 
Code: [Select]
define('MIN_SEARCH_KEYWORD_LENGTH', 1);
Das Plugin "Rebulid Search Index" funktioniert auch nicht resp. es gibt änliche Errors raus. (Habe auch "If you are reindexing, you may want to empty the indexes" durchgeführt, jedoch erfolglos.

Ich brauche unbedingt Hilfe, da ich auf PHP 5 umstellen möchte (aber mit diesen Fehlern nicht umstellen kann).
Auf PHP 4 läuft alles super ohne Fehler.
Vielen, vielen Dank im Voraus.

Grüsse Jones



Testsystem:
4images Mobile Server PHP5 version (http://www.4homepages.de/forum/index.php?topic=18352.msg113964#msg113964)
PHP 5.2.3
Apache 2.0.59
PhpMyAdmin 2.11.5

includes/db_field_definitions.php
Code: [Select]
// >>>>>>>>>>>>>>>>>> [MOD] Google-Map >>>>>>>>>>>>>>>>>>
// Additional fields for Google-Maps:
$additional_image_fields['image_gmap_latitude'] = array($lang['image_gmap_latitude'], "text", 0);
$additional_image_fields['image_gmap_longitude'] = array($lang['image_gmap_longitude'], "text", 0);
$additional_image_fields['image_gmap_zoom'] = array($lang['image_gmap_zoom'], "text", 0);
$additional_image_fields['image_gmap_type'] = array($lang['image_gmap_type'], "text", 0);
$additional_image_fields['image_gmap_show'] = array($lang['image_gmap_show'], "radio", 1)

includes/search_utils.php
Code: [Select]
$search_match_fields = array(
  "image_name" => "name_match",
  "image_description" => "desc_match",
  "image_keywords" => "keys_match",
  "image_gmap_show" => "gmap_match"
);

DB-Eintrag bei PHP 5 auf 4images Mobile Server
Code: [Select]
-- Tabellenstruktur für Tabelle `4images_wordmatch`

CREATE TABLE `4images_wordmatch` (
  `image_id` int(10) unsigned NOT NULL default '0',
  `word_id` int(10) unsigned NOT NULL default '0',
  `name_match` tinyint(1) NOT NULL default '0',
  `desc_match` tinyint(1) NOT NULL default '0',
  `keys_match` tinyint(1) NOT NULL default '0',
  ` gmap_match` tinyint(1) NOT NULL default '0',
  UNIQUE KEY `image_word_id` (`image_id`,`word_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Code: [Select]
Tabellenstruktur für Tabelle `4images_images`

CREATE TABLE `4images_images` (
  `image_id` int(10) unsigned NOT NULL auto_increment,
  `cat_id` int(10) unsigned NOT NULL default '0',
  `user_id` int(11) NOT NULL default '0',
  `image_name` varchar(255) NOT NULL default '',
  `image_description` text NOT NULL,
  `image_keywords` text NOT NULL,
  `image_date` int(11) unsigned NOT NULL default '0',

(..................)

  `image_gmap_longitude` varchar(20) NOT NULL,
  `image_gmap_latitude` varchar(20) NOT NULL,
  `image_gmap_zoom` char(2) default '13',
  `image_gmap_type` tinyint(1) NOT NULL default '3',
  `image_gmap_show` tinyint(1) NOT NULL default '0',

(..................)

  PRIMARY KEY  (`image_id`),
  KEY `cat_id` (`cat_id`),
  KEY `user_id` (`user_id`),
  KEY `image_date` (`image_date`),
  KEY `image_active` (`image_active`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

MODs:
- Google-Maps Integration V.01  http://www.4homepages.de/forum/index.php?topic=16533.0
- Making additional field searchable  http://www.4homepages.de/forum/index.php?topic=1313.msg5562#msg5562
- Batch Copy/Move/Edit Images 4.0 for 1.7.4 - 1.7.6  http://www.4homepages.de/forum/index.php?topic=20501.0
- Plugin - Rebulid Search Index
- Auto image resize on upload
- weitere...

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Tutorial] Making additional field searchable
« Reply #56 on: April 11, 2008, 05:59:24 PM »
Code: [Select]
CREATE TABLE `4images_wordmatch` (
  `image_id` int(10) unsigned NOT NULL default '0',
  `word_id` int(10) unsigned NOT NULL default '0',
  `name_match` tinyint(1) NOT NULL default '0',
  `desc_match` tinyint(1) NOT NULL default '0',
  `keys_match` tinyint(1) NOT NULL default '0',
  ` gmap_match` tinyint(1) NOT NULL default '0',
  UNIQUE KEY `image_word_id` (`image_id`,`word_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Hier liegt der Fehler:
Code: [Select]
` gmap_match` tinyint(1) NOT NULL default '0',
Das Tabellenfeld gmap_match hat ein führendes Leerzeichen. Das ist bei neueren MySQL-Versionen möglich und passiert manchmal wenn man zB mit phpMyAdmin arbeitet.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Re: [Tutorial] Making additional field searchable
« Reply #57 on: April 11, 2008, 07:01:35 PM »
Hallo Jan
Danke für deine Hilfe! Hab dies nicht gesehen...
Das war ja ein einfacher und blöder Fehler, welcher mir unterlaufen war. :evil:
Jetzt funktioniert alles und dem PHP Wechsel steht nicht mehr bevor.
Schönes Weekend.
Gruss Jones

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Tutorial] Making additional field searchable
« Reply #58 on: April 14, 2008, 12:53:40 PM »
Ja, und ohne Deine super Fehlerbeschreibung hätten wir wahrscheinlich noch Wochen gebraucht um ihn zu finden.
Werden den Post als Vorbild für eine perfekte Fehlerbeschreibung bookmarken ;)

Gruß Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Bob

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #59 on: May 24, 2008, 10:40:33 AM »
mhh.. ich bekomms nicht hin :(

Ich hab den PLZ mod: http://www.4homepages.de/forum/index.php?topic=15303.0

und möchte dass man nach plz mitglieder suchen kann hab schon einiges versucht bekomme es aber nicht hin :(

hilft mir da jemand?
« Last Edit: May 28, 2008, 03:04:41 PM by Bob »