Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
dc32e54f
Commit
dc32e54f
authored
Nov 18, 2004
by
Steven Wittens
Browse files
Search.module:
- Caching index statistics - Minor code cleanup
parent
90e67a3a
Changes
4
Hide whitespace changes
Inline
Side-by-side
modules/node.module
View file @
dc32e54f
...
...
@@ -1556,7 +1556,7 @@ function node_update_index() {
// cannot be indexed (PHP nodes which call drupal_goto, for example).
// In rare cases this can mean a node is only partially indexed, but the
// chances of this happening are very small.
variable_set
(
'node_cron_last'
,
max
(
$last_comment
,
max
(
$node
->
changed
,
$node
->
created
))
)
;
variable_set
(
'node_cron_last'
,
max
(
$last_comment
,
$node
->
changed
,
$node
->
created
));
if
(
node_hook
(
$node
,
'view'
))
{
node_invoke
(
$node
,
'view'
,
false
,
false
);
...
...
modules/node/node.module
View file @
dc32e54f
...
...
@@ -1556,7 +1556,7 @@ function node_update_index() {
// cannot be indexed (PHP nodes which call drupal_goto, for example).
// In rare cases this can mean a node is only partially indexed, but the
// chances of this happening are very small.
variable_set
(
'node_cron_last'
,
max
(
$last_comment
,
max
(
$node
->
changed
,
$node
->
created
))
)
;
variable_set
(
'node_cron_last'
,
max
(
$last_comment
,
$node
->
changed
,
$node
->
created
));
if
(
node_hook
(
$node
,
'view'
))
{
node_invoke
(
$node
,
'view'
,
false
,
false
);
...
...
modules/search.module
View file @
dc32e54f
...
...
@@ -127,7 +127,7 @@ function search_admin() {
$output
=
form_group
(
t
(
'Indexing settings'
),
$group
);
// Collect some stats
$estimate
=
db_result
(
db_query
(
'SELECT COUNT(DISTINCT sid) FROM {
search_index
}'
)
);
$estimate
=
variable_get
(
'
search_index
ed'
,
0
);
$nodes
=
max
(
1
,
db_result
(
db_query
(
'SELECT COUNT(*) FROM {node}'
)));
$percentage
=
((
int
)
min
(
100
,
100
*
$estimate
/
$nodes
))
.
'%'
;
$status
=
'<p>'
.
t
(
'Approximately %percentage of the site has been indexed.'
,
array
(
'%percentage'
=>
$percentage
))
.
'</p>'
;
...
...
@@ -200,6 +200,10 @@ function search_cron() {
while
(
$word
=
db_fetch_object
(
$result
))
{
db_query
(
"DELETE FROM
{
search_total
}
WHERE word = '%s'"
,
$word
->
realword
);
}
// Count indexed items (for administration screen)
$indexed
=
db_result
(
db_query
(
'SELECT COUNT(DISTINCT sid) FROM {search_index}'
));
variable_set
(
'search_indexed'
,
$indexed
);
}
/**
...
...
modules/search/search.module
View file @
dc32e54f
...
...
@@ -127,7 +127,7 @@ function search_admin() {
$output
=
form_group
(
t
(
'Indexing settings'
),
$group
);
// Collect some stats
$estimate
=
db_result
(
db_query
(
'SELECT COUNT(DISTINCT sid) FROM {
search_index
}'
)
);
$estimate
=
variable_get
(
'
search_index
ed'
,
0
);
$nodes
=
max
(
1
,
db_result
(
db_query
(
'SELECT COUNT(*) FROM {node}'
)));
$percentage
=
((
int
)
min
(
100
,
100
*
$estimate
/
$nodes
))
.
'%'
;
$status
=
'<p>'
.
t
(
'Approximately %percentage of the site has been indexed.'
,
array
(
'%percentage'
=>
$percentage
))
.
'</p>'
;
...
...
@@ -200,6 +200,10 @@ function search_cron() {
while
(
$word
=
db_fetch_object
(
$result
))
{
db_query
(
"DELETE FROM
{
search_total
}
WHERE word = '%s'"
,
$word
->
realword
);
}
// Count indexed items (for administration screen)
$indexed
=
db_result
(
db_query
(
'SELECT COUNT(DISTINCT sid) FROM {search_index}'
));
variable_set
(
'search_indexed'
,
$indexed
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment