4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 23, 2018, 07:47:40 PM

Login with username, password and session length
Search:     Advanced search
Follow 4images on twitter: Click here to follow!
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support)
| | |-+  Tutorials (Moderators: mawenzi, Rembrandt)
| | | |-+  [Tutorial] Making additional field searchable
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: «« « 1 [2] 3 4 5 » »» Print
This topic has not yet been rated!
Author Topic: [Tutorial] Making additional field searchable  (Read 145074 times)
titi-fr
Newbie
*
Offline Offline

Posts: 25

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #15 on: March 25, 2005, 12:34:32 PM »

here the sample of my rebuilt :

1
2
3
4
5
6
7
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 Mad but only "prix" appeared...
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« 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)
Logged

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)
titi-fr
Newbie
*
Offline Offline

Posts: 25

Thank You
-Given: 0
-Receive: 0


View Profile
« 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
Logged
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #18 on: March 28, 2005, 09:54:41 AM »

I don't know why... but it doesn't work..   Sad

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:
1
2
3
4
5
6
$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:
1
2
$lang['user_name2_only'] = "Nur Name";
$lang['user_vorname_only'] = "Nur Vorname";

In search_form.html I have entered the following code:
1
2
3
4
5
<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
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« 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:
1
2
3
4
              <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...
Logged

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)
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« 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:
1
2
$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
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« 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...
1
<input type="text" name="user_vorname" value="" />
Logged

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)
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« 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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<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>
Logged
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #23 on: March 29, 2005, 11:20:30 PM »

Can anybody help me?

Thank you!

Serge
Logged
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #24 on: March 31, 2005, 09:14:48 AM »

Hi V@no

May be you can give me a hint...  Question

Thank you!
Serge
Logged
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« 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...   Crying or Very sad

I hope, somebody will help me soon..

Thank you!
Logged
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #26 on: April 05, 2005, 12:02:49 PM »

maybe I'm invisible...  Rolling Eyes
Logged
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« 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?

Logged
ascanio
Hero Member
*****
Offline Offline

Posts: 569

Thank You
-Given: 0
-Receive: 3


View Profile WWW
« 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
1
2
3
4
5
6
$search_match_fields = array(
  "image_name" => "name_match",
  "image_description" => "desc_match",
  "image_keywords" => "keys_match",
  "user_city" => "user_city_match"
);

then this:
1
$lang['user_city_only'] = "City only";

Then this:

1
<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

1
2
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?
Logged
TIMT
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 0
-Receive: 0


View Profile
« 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
Logged
Pages: «« « 1 [2] 3 4 5 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.233 seconds with 20 queries.
Post your comments here