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

0 Members and 1 Guest are viewing this topic.

Offline titi-fr

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #15 on: March 25, 2005, 12:34:32 PM »
here the sample of my rebuilt :

Code: [Select]
Processing image Villa Traditionnelle RUY – 2 min. A 43 - 338 000 €, ID 3 ...
DB Error: Bad SQL Query: REPLACE INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match, prix_match) VALUES (3, 181, 1, 1, 0), (3, 1204, 1, 1, 0), (3, 183, 1, 0, 0), (3, 184, 1, 0, 0), (3, 1205, 1, 1, 0), (3, 21, 1, 1, 0), (3, 18, 0, 1, 0), (3, 1206, 0, 1, 0), (3, 22, 0, 1, 0), (3, 23, 0, 1, 0), (3, 1022, 0, 1, 0), (3, 188, 0, 1, 0), (3, 189, 0, 1, 0), (3, 1023, 0, 1, 0), (3, 191, 0, 1, 0), (3, 1207, 0, 1, 0), (3, 27, 0, 1, 0), (3, 1208, 0, 1, 0), (3, 778, 0, 1, 0), (3, 35, 0, 1, 0), (3, 195, 0, 1, 0), (3, 196, 0, 1, 0), (3, 1209, 0, 1, 0), (3, 36, 0, 1, 0), (3, 198, 0, 1, 0), (3, 40, 0, 1, 0), (3, 1210, 0, 1, 0), (3, 1211, 0, 1, 0), (3, 1212, 0, 1, 0), (3, 11, 0, 1, 0), (3, 202, 0, 1, 0), (3, 203, 0, 1, 0), (3, 204, 0, 1, 0), (3, 1030, 0, 1, 0), (3, 1213, 0, 1, 0), (3, 1214, 0, 1, 0), (3, 1215, 0, 1, 0), (3, 688, 0, 0, 1)
Column count doesn't match value count at row 1
OK
Processing image Ferme rénovée la verpillière 327 000 €, ID 2 ...
DB Error: Bad SQL Query: REPLACE INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match, prix_match) VALUES (2, 151, 1, 1, 0), (2, 152, 1, 0, 0), (2, 724, 1, 0, 0), (2, 725, 1, 1, 0), (2, 21, 1, 1, 0), (2, 17, 0, 1, 0), (2, 18, 0, 1, 0), (2, 726, 0, 1, 0), (2, 22, 0, 1, 0), (2, 23, 0, 1, 0), (2, 727, 0, 1, 0), (2, 728, 0, 1, 0), (2, 158, 0, 1, 0), (2, 27, 0, 1, 0), (2, 729, 0, 1, 0), (2, 730, 0, 1, 0), (2, 731, 0, 1, 0), (2, 732, 0, 1, 0), (2, 733, 0, 1, 0), (2, 33, 0, 1, 0), (2, 734, 0, 1, 0), (2, 35, 0, 1, 0), (2, 36, 0, 1, 0), (2, 37, 0, 1, 0), (2, 163, 0, 1, 0), (2, 164, 0, 1, 0), (2, 40, 0, 1, 0), (2, 41, 0, 1, 0), (2, 42, 0, 1, 0), (2, 11, 0, 1, 0), (2, 165, 0, 1, 0), (2, 735, 0, 1, 0), (2, 167, 0, 1, 0), (2, 736, 0, 1, 0), (2, 688, 0, 0, 1)
Column count doesn't match value count at row 1

i've added 3 fields in images wordmatch :x but only "prix" appeared...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Tutorial] Making additional field searchable
« Reply #16 on: March 25, 2005, 02:27:14 PM »
on some servers u can not use non-latin letters...its a server side configuration (mysql)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline titi-fr

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #17 on: March 25, 2005, 02:29:54 PM »
u mean like that: é à etc ?

th fields who doesnt appears are name reference & code, not non-latin

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #18 on: March 28, 2005, 09:54:41 AM »
I don't know why... but it doesn't work..   :(

I have implemented two additionales files: user_vorname and user_name2.

I have entered the two fields name2_match and vorname_match in the table 4images_wordmatch in my database

In search_utils.php I have entered the following code:
Code: [Select]
$search_match_fields = array(
  "image_name" => "name_match",
  "image_description" => "desc_match",
  "image_keywords" => "keys_match",
  "user_vorname" => "vorname_match",
  "user_name2" => "name2_match"

In main.php I have entered the following code:
Code: [Select]
$lang['user_name2_only'] = "Nur Name";
$lang['user_vorname_only'] = "Nur Vorname";

In search_form.html I have entered the following code:
Code: [Select]
<tr>
                  <td nowrap="nowrap" class="td2"><input type="radio" name="search_fields" value="user_vorname" /> {lang_user_vorname_only}</td>
                  <td nowrap="nowrap">&nbsp;</td>
                  <td nowrap="nowrap" class="td2"><input type="radio" name="search_fields" value="user_name2" /> {lang_user_name2_only}</td>               
                </tr>

Than I rebuilded the search index.

On the search-sreen I can see the new radio buttons, but not the description of the radio buttons (regarding the entry in main.php).
The search of "user_name2" or "user_vorname" doesn't work.

Where is the problem?

Thank you for helping me!
Serge

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Tutorial] Making additional field searchable
« Reply #19 on: March 28, 2005, 02:33:45 PM »
1) make sure u've updated includes/db_fields_definitions.php
2) the search_form is wrong, it should be in this format:
Code: [Select]
              <input type="radio" name="user_vorname" value="1"{user_vorname_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_vorname" value="0"{user_vorname_no} />
              {lang_no}
But its hard to tell what exactly are u planning to do...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #20 on: March 28, 2005, 09:29:51 PM »
I'd like to offer the possibility to search for "user_name2" and "user_vorname" (first name).

I have entered in db_field_definitions the following code:
Code: [Select]
$additional_user_fields['user_vorname'] = array($lang['user_vorname'], "text", 1);
$additional_user_fields['user_name2'] = array($lang['user_name2'], "text", 1);

In the profile I can enter the first- and last name. The information is stored correctly in the database. That is not the problem.

But now I want to search after "user_name2" and "user_vorname". And that doesn't work.

I entered the code in search_form.html as it is mentioned in the tutorial.

So I'm a little bit confused about your proposal. What should I do?

Sorry, I have no idea about PHP....

Thank you for helping me.

Serge

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Tutorial] Making additional field searchable
« Reply #21 on: March 28, 2005, 09:37:49 PM »
I dont think u can do it with radio type of input...u'll need add two separate input forms for first and last names...
Code: [Select]
<input type="text" name="user_vorname" value="" />
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #22 on: March 28, 2005, 10:30:17 PM »
that's fine! Do I have to change the field in the database, table 4images_wordmatch ?
is the rest of the instruction regarding the turorial ok?

unfortunately the serach doesn't work. is it possible to enter "user_vorname" and "user_name2" for a single search (e.g. a serach after "Tom Till")

here is the code of my search_form.html

Code: [Select]
<form method="post" action="{url_search}">
  <table width="100%" border="0" cellspacing="0" cellpadding="1">
    <tr>
      <td class="head1">
        <table width="100%" border="0" cellpadding="4" cellspacing="0">
          <tr>
            <td colspan="2" valign="top" class="head1">{lang_search}</td>
          </tr>
         
          <tr>
                  <td valign="top" class="row2"><b>Vorname</b></td>
                  <td class="row2" valign="top">
                  <input class="logininput" type="text" name="user_vorname" value="" /> </td>
                </tr>
                <tr>   
                  <td valign="top" class="row2"><b>Nachname</b></td>
                  <td class="row2" valign="top">
                  <input class="logininput" type="text" name="user_name2" value="" /> </td> 
                </tr>
         
         
          <tr>
            <td valign="top" class="row1"><b>{lang_search_by_keyword}</b></td>
            <td class="row1" valign="top">
              <input type="text" name="search_keywords" size="40" value="{search_keywords}" class="input" />
              <br />
              <input type="checkbox" name="search_new_images" value="1" />
              {lang_new_images_only}</td>
          </tr>
  <tr>
            <td valign="top" class="row2"><b>{lang_search_by_username}</b></td>
            <td class="row2" valign="top">
              <input type="text" name="search_user" size="40" value="{search_user}" class="input" />
            </td>
          </tr>
          <tr>
            <td class="row1"><b>{lang_search_terms}</b></td>
            <td class="row1">
              <input type="radio" name="search_terms" value="all" checked="checked" />
              {lang_and}&nbsp;&nbsp;
              <input type="radio" name="search_terms" value="any" />
              {lang_or}
            </td>
          </tr>
          <tr>
            <td class="row2"><b>{lang_category}</b></td>
            <td class="row2">{category_dropdown}</td>
          </tr>
          <tr>
            <td valign="top" class="row1"><b>{lang_search_fields}</b></td>
            <td class="row1">
              <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td nowrap="nowrap" class="td2"><input type="radio" name="search_fields" value="all" checked="checked" /> {lang_all_fields}</td>
                  <td nowrap="nowrap">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                  <td nowrap="nowrap" class="td2"><input type="radio" name="search_fields" value="image_name" /> {lang_name_only}</td>
                </tr>
                <tr>
                  <td nowrap="nowrap" class="td2"><input type="radio" name="search_fields" value="image_description" /> {lang_description_only}</td>
                  <td nowrap="nowrap">&nbsp;</td>
                  <td nowrap="nowrap" class="td2"><input type="radio" name="search_fields" value="image_keywords" /> {lang_keywords_only}</td>
              </table>
            </td>
          </tr>
          <tr>
            <td class="row1">&nbsp;</td>
            <td class="row1"><input type="submit" value="{lang_search}" class="button" /></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #23 on: March 29, 2005, 11:20:30 PM »
Can anybody help me?

Thank you!

Serge

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #24 on: March 31, 2005, 09:14:48 AM »
Hi V@no

May be you can give me a hint...  :?:

Thank you!
Serge

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #25 on: April 01, 2005, 09:37:21 AM »
I tried again to find a hint to solve my problem.
I found the following post:
http://www.4homepages.de/forum/index.php?topic=2168.0

Unfortunately the mentioned links on this post are not active anymore....

So I'm still sitting on my problem...   :cry:

I hope, somebody will help me soon..

Thank you!

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #26 on: April 05, 2005, 12:02:49 PM »
maybe I'm invisible...  :roll:

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #27 on: April 06, 2005, 10:16:51 PM »
The only thing I want is making new fields searchable. And I did what it is mentioned in the tutorial.
Or have I something misunderstood?


Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [Tutorial] Making additional field searchable
« Reply #28 on: April 11, 2005, 01:44:37 AM »
This is what I have done:

I have created a new column in the table 4images_wordmatch called user_city_match

Then I add this
Code: [Select]
$search_match_fields = array(
  "image_name" => "name_match",
  "image_description" => "desc_match",
  "image_keywords" => "keys_match",
  "user_city" => "user_city_match"
);

then this:
Code: [Select]
$lang['user_city_only'] = "City only";
Then this:

Code: [Select]
<td nowrap="nowrap"><input type="radio" name="search_fields" value="user_city" /> {lang_user_city_only}</td>

I did a Search index rebuilt and I got this

Code: [Select]
DB Error: Bad SQL Query: INSERT INTO girls_wordmatch (image_id, word_id, name_match, desc_match, keys_match, user_city_match) SELECT DISTINCT 7028, word_id, 1, 0, 0, 0 FROM girls_wordlist WHERE word_text = 'fotografia'
Duplicate entry '7028-1531' for key 1

I aslo don't see City only in the search_form.html

What I did wrong?

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [Tutorial] Making additional field searchable
« Reply #29 on: April 24, 2005, 09:48:10 PM »
Hi everybody

I have added two new fields in the database
firstname
lastname
the two new fields can be entered in "edit profile". That's ok!

Now I'd like make the two new fields searchable.

I did all modification but it doesn't work. Please also see the information above.
What did I wrong?

Thank you for helping me!

Serge