Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
15f515e2
Commit
15f515e2
authored
Feb 16, 2007
by
Martyn Smith
Committed by
Martyn Smith
Feb 16, 2007
Browse files
Self search work, and fixes to Solr
parent
78c7af77
Changes
6
Hide whitespace changes
Inline
Side-by-side
htdocs/json/selfsearch.php
View file @
15f515e2
...
...
@@ -37,21 +37,11 @@ catch (ParameterException $e) {
json_reply
(
'missingparameter'
,
'Missing parameter \'query\''
);
}
$type
=
param_variable
(
'type'
,
'user'
);
$type
=
param_variable
(
'type'
,
'all'
);
$limit
=
param_integer
(
'limit'
,
20
);
$offset
=
param_integer
(
'offset'
,
0
);
switch
(
$type
)
{
case
'community'
:
$data
=
search_community
(
$query
,
$limit
,
$offset
,
true
);
$data
[
'type'
]
=
'community'
;
break
;
default
:
$data
=
search_user
(
$query
,
$limit
,
$offset
);
$data
[
'type'
]
=
'user'
;
break
;
}
$data
=
search_selfsearch
(
$query
,
$limit
,
$offset
,
$type
);
json_headers
();
$data
[
'error'
]
=
false
;
...
...
htdocs/lang/en.utf8/mahara.php
View file @
15f515e2
...
...
@@ -60,6 +60,8 @@ $string['select'] = 'Select';
$string
[
'tags'
]
=
'Tags'
;
$string
[
'tagsdesc'
]
=
'Enter comma separated tags for this item'
;
$string
[
'selfsearch'
]
=
'Search My Portfolio'
;
// Quota strings
$string
[
'quota'
]
=
'Quota'
;
$string
[
'quotausage'
]
=
'You have used <span id="quota_used">%s</span> of your <span id="quota_total">%s</span> quota.'
;
...
...
htdocs/lib/searchlib.php
View file @
15f515e2
...
...
@@ -190,4 +190,11 @@ function search_community($query_string, $limit, $offset = 0, $all = false) {
return
call_static_method
(
generate_class_name
(
'search'
,
$plugin
),
'search_community'
,
$query_string
,
$limit
,
$offset
,
$all
);
}
function
search_selfsearch
(
$query_string
,
$limit
,
$offset
,
$type
=
'all'
)
{
$plugin
=
get_config
(
'searchplugin'
);
safe_require
(
'search'
,
$plugin
);
return
call_static_method
(
generate_class_name
(
'search'
,
$plugin
),
'self_search'
,
$query_string
,
$limit
,
$offset
,
$type
);
}
?>
htdocs/lib/web.php
View file @
15f515e2
...
...
@@ -260,7 +260,14 @@ EOF;
);
}
if
(
!
$USER
->
is_logged_in
())
{
if
(
$USER
->
is_logged_in
())
{
$SIDEBLOCKS
[]
=
array
(
'name'
=>
'selfsearch'
,
'weight'
=>
0
,
'data'
=>
array
(),
);
}
else
{
$SIDEBLOCKS
[]
=
array
(
'name'
=>
'login'
,
'weight'
=>
-
10
,
...
...
@@ -271,6 +278,7 @@ EOF;
);
}
if
(
isset
(
$extraconfig
[
'sideblocks'
])
&&
is_array
(
$extraconfig
[
'sideblocks'
]))
{
foreach
(
$extraconfig
[
'sideblocks'
]
as
$sideblock
)
{
$SIDEBLOCKS
[]
=
$sideblock
;
...
...
htdocs/search/solr/lib.php
View file @
15f515e2
...
...
@@ -62,14 +62,23 @@ class PluginSearchSolr extends PluginSearchInternal {
}
public
static
function
event_reindex_user
(
$event
,
$user
)
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
return
;
}
self
::
index_user
(
$user
);
self
::
commit
();
}
public
static
function
event_saveartefact
(
$event
,
$artefact
)
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
return
;
}
self
::
index_artefact
(
$artefact
);
self
::
commit
();
}
public
static
function
event_deleteartefact
(
$event
,
$artefact
)
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
return
;
}
self
::
delete_byidtype
(
$artefact
->
get
(
'id'
),
'artefact'
);
self
::
commit
();
}
...
...
@@ -193,10 +202,15 @@ END;
$result
=
$new_result
;
}
}
return
$results
;
}
// This function will rebuild the solr indexes
public
static
function
rebuild_all
()
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
return
;
}
self
::
rebuild_users
();
self
::
rebuild_artefacts
();
self
::
commit
();
...
...
@@ -373,7 +387,7 @@ END;
if
(
is_array
(
$value
))
{
$value
=
implode
(
'" OR "'
,
$value
);
}
array_push
(
$q
,
$key
.
':(
"
'
.
$value
.
'
"
)'
);
array_push
(
$q
,
$key
.
':('
.
$value
.
')'
);
}
require_once
(
'snoopy/Snoopy.class.php'
);
...
...
htdocs/theme/default/templates/header.tpl
View file @
15f515e2
...
...
@@ -2,6 +2,7 @@
<html>
<head>
<title>
{
$PAGETITLE
|
escape
}
</title>
<script
type=
"text/javascript"
src=
"
{
$WWWROOT
}
js/firebug/firebug.js"
></script>
<script
type=
"text/javascript"
>
var
config
=
{
literal
}{{/
literal
}
'theme'
:
{
$THEMELIST
}
,
...
...
Write
Preview
Supports
Markdown
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