How is the search function suposed to work?
|
danjoh
![]()
Joined: 2009-01-17
Posts: 15 |
Posted: Sat, 2009-07-25 15:34
|
|
I am back playing with G3 and I can not get the search function to work. Regards, |
|
| Login or register to post comments |


Posts: 13007
I think, (I hope really) that there is still work to be done on that. For example, I have a photo title Fred_03. Searching for Fred, finds nothing. But searching for Fred_03 will find the photo.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 6688
It should find words that you put into your description, and if you get the latest code and rebuild your search index (in mysql, do "truncate search_records" then go to Admin > Maintenance) then it'll index tags too.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git | help! vote!
Posts: 15
Great, I'll try in a few days and come back with the result.
--
Dan
Posts: 15
Today I finally got around to upgrade to the latest nightly release (gallery-gallery3-7ad0808a117fd1db4e94da8d7763ccca1d69350a.zip).
I can now see in the search_records table that the Tag entry is there:
But when I do a search (Per or per) it still does not show.
--
Dan
Posts: 15
I have been playing a little bit more and found the following:
1) If I add a Tag to a photo using the "Edit this photo", the search_records table does not get updated.
2) A bit more troublesome is that the search for "Per" in my last post does not fail due to a bug or such in G3 - it is mysql's MATCH ... AGAINST construct that "filers" this. If I set the Tag to "Robert" it get found as it should. The problem for me is that I planned to use the Tag function to record the name of the persons in the photo and in Swedish we have a lot names the are short (like Dan, Per, ...).
--
Dan
Posts: 6688
1) http://sourceforge.net/apps/trac/gallery/ticket/617 -- good catch!
I have no ideas about that currently.
2) http://sourceforge.net/apps/trac/gallery/ticket/618 -- this will be harder to fix.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git | help! vote!
Posts: 15
For (2) I have found the reason for not finding the text and a dirty workaround.
The reason for not finding "Per" is twofold:
a) The default min length in mysql for search words are 4 chars.
b) The word "per" is in the default "Stop-Word-File" (mysql source file: storage/myisam/ft_static.c) and will not be considered in the search.
And here is my workaround:
In the mysql configuration file I had to add the following two lines to the [mysqld] section.
And rebuild the search_records table
Now I can search for "Per" and it gets found.
mysql> SELECT * FROM search_records WHERE MATCH(search_records.data) AGAINST ('per' IN BOOLEAN MODE); +----+---------+-------+----------------------------+ | id | item_id | dirty | data | +----+---------+-------+----------------------------+ | 28 | 28 | 0 | dsc02756.jpg dsc02756 Per | +----+---------+-------+----------------------------+ 1 row in set (0.00 sec)The big drawback with this approach is that this effects the whole mysql-server, so if you have other DB's in the same server where you use the fulltext search its behavior gets changed as well.
--
Dan