In this post we will learn about how to reindex lucene search in Owncloud 5.0.22. While working in Owncloud 5.0.22 our requirement was to reindex the lucene search.
Overview: When a user placed a cursor and type some keyword ,bydefault it creates a directory lucene_index (absolute path is /path/of/owncloud_installed_dir/data/username/lucene_index ) . On writing the keyword in search box in owncloud, inside lucene_index directory some files will be created.The below given 4 files get created on initial stage and after indexing some more files will be created inside lucene_index directory and some files name will also start with underscore ( _ ).
The below given 4 files will be created when lucene search script start doing indexing.
read.lock.file segments_1 segments.gen write.lock.file
After proper indexing some more files will be created(Note: the number of files may vary in case to case scenario.)
Below given is specimen from my Owncloud Server:
root@owncloud-server:/var/www/owncloud/data/sharad# ls -l lucene_index/ total 240 -rwxrwx--- 1 www-data www-data 435 2013-11-14 17:15 _10.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _10.sti -rwxrwx--- 1 www-data www-data 450 2013-11-14 17:15 _11.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _11.sti -rwxrwx--- 1 www-data www-data 511 2013-11-14 17:15 _12.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _12.sti -rwxrwx--- 1 www-data www-data 515 2013-11-14 17:15 _13.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _13.sti -rwxrwx--- 1 www-data www-data 527 2013-11-14 17:15 _14.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _14.sti -rwxrwx--- 1 www-data www-data 528 2013-11-14 17:15 _15.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _15.sti -rwxrwx--- 1 www-data www-data 499 2013-11-14 17:15 _16.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _16.sti -rwxrwx--- 1 www-data www-data 497 2013-11-14 17:15 _17.cfs -rwxrwx--- 1 www-data www-data 2359 2013-11-14 17:15 _18.cfs -rwxrwx--- 1 www-data www-data 1773 2013-11-14 17:14 _b.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:14 _b.sti -rwxrwx--- 1 www-data www-data 2046 2013-11-14 17:14 _m.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:14 _m.sti -rwxrwx--- 1 www-data www-data 0 2013-11-14 17:15 optimization.lock.file -rwxrwx--- 1 www-data www-data 0 2013-11-14 17:15 read.lock.file -rwxrwx--- 1 www-data www-data 0 2013-11-14 17:15 read-lock-processing.lock.file -rwxrwx--- 1 www-data www-data 127 2013-11-14 17:15 segments_1d -rwxrwx--- 1 www-data www-data 20 2013-11-14 17:15 segments.gen -rwxrwx--- 1 www-data www-data 521 2013-11-14 17:14 _w.cfs -rwxrwx--- 1 www-data www-data 0 2013-11-14 17:15 write.lock.file -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:14 _w.sti -rwxrwx--- 1 www-data www-data 2426 2013-11-14 17:14 _x.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:14 _x.sti -rwxrwx--- 1 www-data www-data 451 2013-11-14 17:14 _y.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _y.sti -rwxrwx--- 1 www-data www-data 419 2013-11-14 17:15 _z.cfs -rwxrwx--- 1 www-data www-data 107 2013-11-14 17:15 _z.sti
Reindex lucene search in owncloud 5
The given below are details of owncloud server,replace the values as per your server information
MySQL Server Host : localhost (replace with your server FQDN or ip address)
MySQL Database Name : owncloud
MySQL user name : ownclouduser [this is owncloud application’s database user] (or use root)
Table on which we will work : oc_lucene_status and oc_filecache.
Note: Here oc_lucene_status table will play important role.
Step 1: login into your mysql server and give password of MySQL user when it will ask.
mysql -u ownclouduser -h localhost -p
Step 2: After login into MySQL server, connect to owncloud database
mysql > use owncloud ;
Step 3 : Now clear the oc_lucene_status table. (Reference from Owncloud GitHub)
You can use any one method for clearing the oc_lucene_status table.
(Method 1)
mysql > DELETE FROM oc_lucene_status WHERE 1=1;
OR
(Method 2)
mysql > truncate oc_lucene_status;
Step 4: As I was working in more than 100Gb data in owncloud I faced some issues in lucene indexing and file cacheing. Hence cleared the oc_filecache table as well removed cache and lucene_index directory from username directory.
mysql> truncate oc_filecache; mysql> exit
In below command,replace the username with your owncloud login user name and also replace the installed owncloud path with /var/www/owncloud
rm -fr /var/www/owncloud/data/username/cache rm -fr /var/www/owncloud/data/username/lucene_index
Step 5: Now open the web browser and type your owncloud server URL.Login into with your user
http://owncloudserver-ipaddress-or-domain-name
For eg.
http://localhost/owncloud
After login now go to search box and type keyword,you will get loader image rotating,which means indexing has been started. You have to wait and must have patience also.Sometimes it do not show indexing suddenly,in my case I had to wait maximum 15-20 minutes because I has 2-5 GB of data in single user account.
Logout and login back and check once again typing keyword in search box.
Below screenshot is reference:
Leave a Reply