Search with tags now works fast.
This commit is contained in:
parent
8392217b72
commit
9877e43bda
2 changed files with 24 additions and 23 deletions
|
@ -241,31 +241,31 @@ function notifier_run(&$argv, &$argc){
|
||||||
|
|
||||||
// if $parent['wall'] == 1 we will already have the parent message in our array
|
// if $parent['wall'] == 1 we will already have the parent message in our array
|
||||||
// and we will relay the whole lot.
|
// and we will relay the whole lot.
|
||||||
|
|
||||||
// expire sends an entire group of expire messages and cannot be forwarded.
|
// expire sends an entire group of expire messages and cannot be forwarded.
|
||||||
// However the conversation owner will be a part of the conversation and will
|
// However the conversation owner will be a part of the conversation and will
|
||||||
// be notified during this run.
|
// be notified during this run.
|
||||||
// Other DFRN conversation members will be alerted during polled updates.
|
// Other DFRN conversation members will be alerted during polled updates.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Diaspora members currently are not notified of expirations, and other networks have
|
// Diaspora members currently are not notified of expirations, and other networks have
|
||||||
// either limited or no ability to process deletions. We should at least fix Diaspora
|
// either limited or no ability to process deletions. We should at least fix Diaspora
|
||||||
// by stringing togther an array of retractions and sending them onward.
|
// by stringing togther an array of retractions and sending them onward.
|
||||||
|
|
||||||
|
|
||||||
$localhost = str_replace('www.','',$a->get_hostname());
|
$localhost = str_replace('www.','',$a->get_hostname());
|
||||||
if(strpos($localhost,':'))
|
if(strpos($localhost,':'))
|
||||||
$localhost = substr($localhost,0,strpos($localhost,':'));
|
$localhost = substr($localhost,0,strpos($localhost,':'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Be VERY CAREFUL if you make any changes to the following several lines. Seemingly innocuous changes
|
* Be VERY CAREFUL if you make any changes to the following several lines. Seemingly innocuous changes
|
||||||
* have been known to cause runaway conditions which affected several servers, along with
|
* have been known to cause runaway conditions which affected several servers, along with
|
||||||
* permissions issues.
|
* permissions issues.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$relay_to_owner = false;
|
$relay_to_owner = false;
|
||||||
|
|
||||||
if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
|
if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
|
||||||
|
@ -274,8 +274,8 @@ function notifier_run(&$argv, &$argc){
|
||||||
|
|
||||||
|
|
||||||
if(($cmd === 'uplink') && (intval($parent['forum_mode']) == 1) && (! $top_level)) {
|
if(($cmd === 'uplink') && (intval($parent['forum_mode']) == 1) && (! $top_level)) {
|
||||||
$relay_to_owner = true;
|
$relay_to_owner = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// until the 'origin' flag has been in use for several months
|
// until the 'origin' flag has been in use for several months
|
||||||
// we will just use it as a fallback test
|
// we will just use it as a fallback test
|
||||||
|
@ -452,7 +452,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
$photos[$p['scale']] = $a->get_baseurl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
|
$photos[$p['scale']] = $a->get_baseurl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
|
||||||
}
|
}
|
||||||
unset($rp, $ext);
|
unset($rp, $ext);
|
||||||
|
|
||||||
$atom .= replace_macros($sugg_template, array(
|
$atom .= replace_macros($sugg_template, array(
|
||||||
'$name' => xmlify($owner['name']),
|
'$name' => xmlify($owner['name']),
|
||||||
'$photo' => xmlify($photos[4]),
|
'$photo' => xmlify($photos[4]),
|
||||||
|
@ -577,12 +577,12 @@ function notifier_run(&$argv, &$argc){
|
||||||
// This controls the number of deliveries to execute with each separate delivery process.
|
// This controls the number of deliveries to execute with each separate delivery process.
|
||||||
// By default we'll perform one delivery per process. Assuming a hostile shared hosting
|
// By default we'll perform one delivery per process. Assuming a hostile shared hosting
|
||||||
// provider, this provides the greatest chance of deliveries if processes start getting
|
// provider, this provides the greatest chance of deliveries if processes start getting
|
||||||
// killed. We can also space them out with the delivery_interval to also help avoid them
|
// killed. We can also space them out with the delivery_interval to also help avoid them
|
||||||
// getting whacked.
|
// getting whacked.
|
||||||
|
|
||||||
// If $deliveries_per_process > 1, we will chain this number of multiple deliveries
|
// If $deliveries_per_process > 1, we will chain this number of multiple deliveries
|
||||||
// together into a single process. This will reduce the overall number of processes
|
// together into a single process. This will reduce the overall number of processes
|
||||||
// spawned for each delivery, but they will run longer.
|
// spawned for each delivery, but they will run longer.
|
||||||
|
|
||||||
$deliveries_per_process = intval(get_config('system','delivery_batch_count'));
|
$deliveries_per_process = intval(get_config('system','delivery_batch_count'));
|
||||||
if($deliveries_per_process <= 0)
|
if($deliveries_per_process <= 0)
|
||||||
|
@ -597,8 +597,8 @@ function notifier_run(&$argv, &$argc){
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// potentially more than one recipient. Start a new process and space them out a bit.
|
// potentially more than one recipient. Start a new process and space them out a bit.
|
||||||
// we will deliver single recipient types of message and email recipients here.
|
// we will deliver single recipient types of message and email recipients here.
|
||||||
|
|
||||||
if((! $mail) && (! $fsuggest) && (!$relocate) && (! $followup)) {
|
if((! $mail) && (! $fsuggest) && (!$relocate) && (! $followup)) {
|
||||||
|
|
||||||
$this_batch[] = $contact['id'];
|
$this_batch[] = $contact['id'];
|
||||||
|
|
|
@ -130,8 +130,8 @@ function search_content(&$a) {
|
||||||
if($tag) {
|
if($tag) {
|
||||||
$sql_extra = "";
|
$sql_extra = "";
|
||||||
|
|
||||||
$sql_table = sprintf("`item` INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
|
$sql_table = sprintf("`item` INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d) AS `term` ON `item`.`id` = `term`.`oid` ",
|
||||||
dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(local_user()));
|
dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
|
||||||
|
|
||||||
$sql_order = "`item`.`id`";
|
$sql_order = "`item`.`id`";
|
||||||
} else {
|
} else {
|
||||||
|
@ -141,7 +141,8 @@ function search_content(&$a) {
|
||||||
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
|
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
|
||||||
}
|
}
|
||||||
$sql_table = "`item`";
|
$sql_table = "`item`";
|
||||||
$sql_order = "`item`.`received`";
|
$sql_order = "`item`.`id`";
|
||||||
|
//$sql_order = "`item`.`received`";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here is the way permissions work in the search module...
|
// Here is the way permissions work in the search module...
|
||||||
|
@ -171,7 +172,7 @@ function search_content(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
|
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
|
||||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
|
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
|
||||||
|
@ -182,7 +183,7 @@ function search_content(&$a) {
|
||||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||||
AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0 )
|
AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0 )
|
||||||
OR ( `item`.`uid` = %d ))
|
OR ( `item`.`uid` = %d ))
|
||||||
$sql_extra
|
$sql_extra GROUP BY `item`.`uri`
|
||||||
ORDER BY $sql_order DESC LIMIT %d , %d ",
|
ORDER BY $sql_order DESC LIMIT %d , %d ",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
intval($a->pager['start']),
|
intval($a->pager['start']),
|
||||||
|
|
Loading…
Reference in a new issue