| |
83 |
83 |
@param datasource name of the datasource array |
| |
84 |
84 |
|
| |
85 |
85 |
@return ignored |
| |
86 |
86 |
|
| |
87 |
87 |
@author Jeff Davis (davis@xarg.net) |
| |
88 |
88 |
} - |
| |
89 |
89 |
|
| |
90 |
90 |
|
| |
91 |
91 |
ad_proc -private search::indexer {} { |
| |
92 |
92 |
Search indexer loops over the existing entries in the search_observer_queue |
| |
93 |
93 |
table and calls the appropriate driver functions to index, update, or |
| |
94 |
94 |
delete the entry. |
| |
95 |
95 |
|
| |
96 |
96 |
@author Neophytos Demetriou |
| |
97 |
97 |
@author Jeff Davis (davis@xarg.net) |
| |
98 |
98 |
} { |
| |
99 |
99 |
|
| |
100 |
100 |
set driver [ad_parameter -package_id [apm_package_id_from_key search] FtsEngineDriver] |
| |
101 |
101 |
|
| |
102 |
102 |
if { $driver eq "" |
| |
103 |
|
|| (![callback::exists -callback search::index -impl $driver] && ! [acs_sc_binding_exists_p FtsEngineDriver $driver])} { |
| |
|
103 |
|| ! [acs_sc_binding_exists_p FtsEngineDriver $driver]} { |
| |
104 |
104 |
# Nothing to do if no driver |
| |
105 |
105 |
ns_log Debug "search::indexer: driver=$driver binding exists? [acs_sc_binding_exists_p FtsEngineDriver $driver]" |
| |
106 |
106 |
return |
| |
107 |
107 |
} |
| |
108 |
108 |
# JCD: pull out the rows all at once so we release the handle |
| |
109 |
109 |
foreach row [db_list_of_lists search_observer_queue_entry {}] { |
| |
110 |
110 |
nsv_incr search_static_variables item_counter |
| |
111 |
111 |
if {[nsv_get search_static_variables item_counter] > 1000} { |
| |
112 |
112 |
nsv_set search_static_variables item_counter 0 |
| |
113 |
113 |
db_exec_plsql optimize_intermedia_index {begin |
| |
114 |
114 |
ctx_ddl.sync_index ('swi_index'); |
| |
115 |
115 |
end; |
| |
116 |
116 |
} |
| |
117 |
117 |
} |
| |
118 |
118 |
foreach {object_id event_date event} $row { break } |
| |
119 |
119 |
array unset datasource |
| |
120 |
120 |
switch -- $event { |
| |
121 |
121 |
UPDATE - |
| |
122 |
122 |
INSERT { |
| |
123 |
123 |
# Don't bother reindexing if we've already inserted/updated this object in this run |