I found it a good idea to add to aspseek the ability,
to index just one specific site on demand.
The code is pretty straightforward.

Added the -b flag to denote site_id as an command line option.


[root@achill aspseek-1.0.2]# diff include/database.h include/database.h.orig 
109c109
<       int MarkForReindex(int SID);
---
>       int MarkForReindex();
[root@achill aspseek-1.0.2]# 

[root@achill aspseek-1.0.2]# diff src/index.cpp src/index.cpp.orig 
54,56d53
< 
< int   achSiteId;
< 
103d99
<       fprintf(stderr, "  -b siteid     Index Only urlz from this site\n");
343c339
<                       result = database->MarkForReindex(achSiteId);
---
>                       result = database->MarkForReindex();
382c378
<               if (database->MarkForReindex(achSiteId) == IND_ERROR) return 1;
---
>               if (database->MarkForReindex() == IND_ERROR) return 1;
843a840
> 
879c876
<       achSiteId = 0;
---
> 
881c878
<       while ((ch = getopt(argc, argv, 
"FUMVEKLCSaheomdqiwlDB?t:u:s:n:L:D:N:R:f:c:r:P:T:g:A:b:")) != -1)
---
>       while ((ch = getopt(argc, argv, 
>"FUMVEKLCSaheomdqiwlDB?t:u:s:n:L:D:N:R:f:c:r:P:T:g:A:")) != -1)
939d935
<               case 'b': achSiteId = atoi(optarg); break;
[root@achill aspseek-1.0.2]# 


[root@achill aspseek-1.0.2]# diff src/squeue.cpp src/squeue.cpp.orig 
37,38d36
< extern int achSiteId;
< 
214,218d211
<       char achClause[200];
<         if (achSiteId)
<                 sprintf(achClause,"AND site_id=%d",achSiteId);
<         else
<                 sprintf(achClause,"");
225c218
<               sprintf(qSel, "SELECT url_id,site_id,next_index_time FROM urlword 
WHERE deleted=0 AND next_index_time<=%d AND next_index_time > %i %s %s ORDER BY 
next_index_time LIMIT %lu", (int)now(), m_maxtime, Limit.c_str(), achClause, 
NextDocLimit);
---
>               sprintf(qSel, "SELECT url_id,site_id,next_index_time FROM urlword 
>WHERE deleted=0 AND next_index_time<=%d AND next_index_time > %i %s ORDER BY 
>next_index_time LIMIT %lu", (int)now(), m_maxtime, Limit.c_str(), NextDocLimit);
[root@achill aspseek-1.0.2]# 
[root@achill aspseek-1.0.2]# 


Plz let me know if you plan to support this in a later version.
Thanx

Achilleus

Reply via email to