4images Modifications / Modifikationen > Tutorials
[Tutorial] Making additional field searchable
Ofuuzo:
- first only a englisch version ...
- eine deutsche Version kommt bald ... oder später ... ;) ... zwischenzeitlich nutze diese Deutsche-Google-Übersetzung ...
I have added a field to the database to show not only the keywords, description, date ... . How can I make it searchable just like keywords, and description fields?
Thanks.
- Ofuuzo
Jan:
In this example, i presuppose that you have added a new field called image_photographer.
1. Create a new column in the table 4images_wordmatch called photographer_match
--- Code: ---ALTER TABLE 4images_wordmatch ADD photographer_match TINYINT(1) DEFAULT '0' NOT NULL;
--- End code ---
2. Open includes/search_utils.php and find this part
--- Code: ---$search_match_fields = array(
"image_name" => "name_match",
"image_description" => "desc_match",
"image_keywords" => "keys_match"
);
--- End code ---
add a new line to the array:
--- Code: ---$search_match_fields = array(
"image_name" => "name_match",
"image_description" => "desc_match",
"image_keywords" => "keys_match",
"image_photographer" => "photographer_match"
);
--- End code ---
Note the comma added behind the third line!
3. Open main.php in your lang folders and add a new line:
--- Code: ---$lang['image_photographer_only'] = "Only Photographer";
--- End code ---
Do this for all your languages!
4. Open the template search_form.html and add this:
--- Code: ---<input type="radio" name="search_fields" value="image_photographer" /> {lang_image_photographer_only}
--- End code ---
5. Rebuild the search index.
You can use the plugin from here.
Greets Jan
Ofuuzo:
That is great great great!!!,
Thank you very very much.
- Ofuuzo
Dmitro:
Jan,
I have done all what you wrote above to make one of the fields searcheable. All should be fine, but, I have a misterious problem with some of my keywords:
Short keywords such as 16, 17, 18 do not return any records, while other keywords (longer numbers, such as 1666 and words such as violin, braccio etc ) make the job without any trouble.
What is the problem?
Thanks, indeed.
Dmitry
Jan:
If you use version 1.7 you can define the min and max searchword length in "includes/constants.php".
--- Code: ---define('MIN_SEARCH_KEYWORD_LENGTH', 3);
define('MAX_SEARCH_KEYWORD_LENGTH', 25);
--- End code ---
After changing that, please rebuild your searchindex.
Greets Jan
Navigation
[0] Message Index
[#] Next page
Go to full version