Fixed the search function that broke in 7.0.7.
also fixed a user profile problemm
This commit is contained in:
parent
41bd19736c
commit
58b3128a3a
6 changed files with 51 additions and 37 deletions
|
|
@ -27,6 +27,10 @@
|
||||||
- fix: File Upload - documented HTTP file upload size limitations in File
|
- fix: File Upload - documented HTTP file upload size limitations in File
|
||||||
Pile Assets Hover help as well as the WebGUI settings documentation for Max
|
Pile Assets Hover help as well as the WebGUI settings documentation for Max
|
||||||
Upload size.
|
Upload size.
|
||||||
|
- Eliminated several hundred queries to the database during certain user
|
||||||
|
profile field options.
|
||||||
|
- Fixed the search function that broke in 7.0.7.
|
||||||
|
|
||||||
|
|
||||||
7.0.7
|
7.0.7
|
||||||
- rfe: Image Management (funded by Formation Design Systems)
|
- rfe: Image Management (funded by Formation Design Systems)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,14 @@ upgrading from one version to the next, or even between multiple
|
||||||
versions. Be sure to heed the warnings contained herein as they will
|
versions. Be sure to heed the warnings contained herein as they will
|
||||||
save you many hours of grief.
|
save you many hours of grief.
|
||||||
|
|
||||||
|
7.0.8
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
* 7.0.7 was released with a critical bug that broke the search engine
|
||||||
|
for many sites, but not all. This bug has been corrected and tests
|
||||||
|
have been written to help ensure it doesn't happen again. However,
|
||||||
|
as a result you must rerun the search indexer program (sbin/search.pl)
|
||||||
|
on all your sites.
|
||||||
|
|
||||||
|
|
||||||
7.0.4
|
7.0.4
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -20,19 +20,21 @@ my $quiet; # this line required
|
||||||
|
|
||||||
my $session = start(); # this line required
|
my $session = start(); # this line required
|
||||||
fixRobotsTxtMimeType($session);
|
fixRobotsTxtMimeType($session);
|
||||||
|
fixSearch();
|
||||||
|
|
||||||
# upgrade functions go here
|
# upgrade functions go here
|
||||||
|
|
||||||
finish($session); # this line required
|
finish($session); # this line required
|
||||||
|
|
||||||
|
|
||||||
##-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#sub exampleFunction {
|
sub fixSearch {
|
||||||
# my $session = shift;
|
print "\tFixing search.\n" unless ($quiet);
|
||||||
# print "\tWe're doing some stuff here that you should know about.\n" unless ($quiet);
|
$session->db->write("alter table assetIndex add column lineage varchar(255)");
|
||||||
# # and here's our code
|
|
||||||
#}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
sub fixRobotsTxtMimeType {
|
sub fixRobotsTxtMimeType {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
print "\tFixing MIME type of robots.txt snippet.\n" unless $quiet;
|
print "\tFixing MIME type of robots.txt snippet.\n" unless $quiet;
|
||||||
|
|
|
||||||
|
|
@ -37,17 +37,23 @@ These methods are available from this package:
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
sub _getQuery {
|
=head2 _getQuery ( columnsToSelect )
|
||||||
|
|
||||||
|
This is a private method and should never be used outside of this class.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub _getQuery {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $selectsRef = shift;
|
my $selectsRef = shift;
|
||||||
return
|
return ('select ' . join(', ', @$selectsRef, ($self->{_score} ? $self->{_score} : ())) . ' from assetIndex where '
|
||||||
('select ' . join(', ', @$selectsRef,
|
. ($self->{_isPublic}? 'isPublic = 1 and ' : '')
|
||||||
($self->{_score}? $self->{_score} : ())) .
|
. '('.$self->{_where}.')'
|
||||||
' from assetIndex inner join asset on assetIndex.assetId = asset.assetId where ' .
|
. ($self->{_score} ? ' order by score desc' : '')
|
||||||
($self->{_isPublic}? 'isPublic = 1 and ' : '') . '('.$self->{_where}.')' .
|
);
|
||||||
($self->{_score}? ' order by score desc' : ''));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getAssetIds ( )
|
=head2 getAssetIds ( )
|
||||||
|
|
@ -58,7 +64,7 @@ Returns an array reference containing all the asset ids of the assets that match
|
||||||
|
|
||||||
sub getAssetIds {
|
sub getAssetIds {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $query = $self->_getQuery(['assetIndex.assetId']);
|
my $query = $self->_getQuery(['assetId']);
|
||||||
my $rs = $self->session->db->prepare($query);
|
my $rs = $self->session->db->prepare($query);
|
||||||
$rs->execute($self->{_params});
|
$rs->execute($self->{_params});
|
||||||
my @ids = ();
|
my @ids = ();
|
||||||
|
|
@ -79,8 +85,7 @@ Returns an array reference containing asset objects for those that matched.
|
||||||
|
|
||||||
sub getAssets {
|
sub getAssets {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $query = $self->_getQuery(['assetIndex.assetId', 'assetIndex.className',
|
my $query = $self->_getQuery([qw(assetId className revisionDate)]);
|
||||||
'assetIndex.revisionDate']);
|
|
||||||
my $rs = $self->session->db->prepare($query);
|
my $rs = $self->session->db->prepare($query);
|
||||||
$rs->execute($self->{_params});
|
$rs->execute($self->{_params});
|
||||||
my @assets = ();
|
my @assets = ();
|
||||||
|
|
@ -126,11 +131,7 @@ sub getPaginatorResultSet {
|
||||||
my $paginate = shift;
|
my $paginate = shift;
|
||||||
my $pageNumber = shift;
|
my $pageNumber = shift;
|
||||||
my $formVar = shift;
|
my $formVar = shift;
|
||||||
my $query = $self->_getQuery(['assetIndex.assetId', 'assetIndex.title',
|
my $query = $self->_getQuery([qw(assetId title url synopsis ownerUserId groupIdView groupIdEdit creationDate revisionDate className)]);
|
||||||
'assetIndex.url', 'assetIndex.synopsis',
|
|
||||||
'assetIndex.ownerUserId', 'assetIndex.groupIdView',
|
|
||||||
'assetIndex.groupIdEdit', 'assetIndex.creationDate',
|
|
||||||
'assetIndex.revisionDate', 'assetIndex.className']);
|
|
||||||
my $paginator = WebGUI::Paginator->new($self->session, $url, $paginate, $pageNumber, $formVar);
|
my $paginator = WebGUI::Paginator->new($self->session, $url, $paginate, $pageNumber, $formVar);
|
||||||
$paginator->setDataByQuery($query, undef, undef, $self->{_params});
|
$paginator->setDataByQuery($query, undef, undef, $self->{_params});
|
||||||
return $paginator;
|
return $paginator;
|
||||||
|
|
@ -146,18 +147,14 @@ Returns a WebGUI::SQL::ResultSet object containing the search results with colum
|
||||||
|
|
||||||
sub getResultSet {
|
sub getResultSet {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $query = $self->_getQuery(['assetIndex.assetId', 'assetIndex.title',
|
my $query = $self->_getQuery([qw(assetId title url synopsis ownerUserId groupIdView groupIdEdit creationDate revisionDate className)]);
|
||||||
'assetIndex.url', 'assetIndex.synopsis',
|
|
||||||
'assetIndex.assetId', 'assetIndex.title',
|
|
||||||
'assetIndex.url', 'assetIndex.synopsis',
|
|
||||||
'assetIndex.ownerUserId', 'assetIndex.groupIdView',
|
|
||||||
'assetIndex.groupIdEdit', 'assetIndex.creationDate',
|
|
||||||
'assetIndex.revisionDate', ' assetIndex.className']);
|
|
||||||
my $rs = $self->session->db->prepare($query);
|
my $rs = $self->session->db->prepare($query);
|
||||||
$rs->execute($self->{_params});
|
$rs->execute($self->{_params});
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 new ( session [ , isPublic ] )
|
=head2 new ( session [ , isPublic ] )
|
||||||
|
|
@ -291,15 +288,15 @@ sub search {
|
||||||
$keywords = join(" ", @terms);
|
$keywords = join(" ", @terms);
|
||||||
}
|
}
|
||||||
push(@params, $keywords, $keywords);
|
push(@params, $keywords, $keywords);
|
||||||
$self->{_score} = "match (assetIndex.keywords) against (?) as score";
|
$self->{_score} = "match (keywords) against (?) as score";
|
||||||
push(@clauses, "match (assetIndex.keywords) against (? in boolean mode)");
|
push(@clauses, "match (keywords) against (? in boolean mode)");
|
||||||
}
|
}
|
||||||
if ($rules->{lineage}) {
|
if ($rules->{lineage}) {
|
||||||
my @phrases = ();
|
my @phrases = ();
|
||||||
foreach my $lineage (@{$rules->{lineage}}) {
|
foreach my $lineage (@{$rules->{lineage}}) {
|
||||||
next unless defined $lineage;
|
next unless defined $lineage;
|
||||||
push(@params, $lineage."%");
|
push(@params, $lineage."%");
|
||||||
push(@phrases, "asset.lineage like ?");
|
push(@phrases, "lineage like ?");
|
||||||
}
|
}
|
||||||
push(@clauses, join(" or ", @phrases)) if (scalar(@phrases));
|
push(@clauses, join(" or ", @phrases)) if (scalar(@phrases));
|
||||||
}
|
}
|
||||||
|
|
@ -308,20 +305,20 @@ sub search {
|
||||||
foreach my $class (@{$rules->{classes}}) {
|
foreach my $class (@{$rules->{classes}}) {
|
||||||
next unless defined $class;
|
next unless defined $class;
|
||||||
push(@params, $class);
|
push(@params, $class);
|
||||||
push(@phrases, "assetIndex.className=?");
|
push(@phrases, "className=?");
|
||||||
}
|
}
|
||||||
push(@clauses, join(" or ", @phrases)) if (scalar(@phrases));
|
push(@clauses, join(" or ", @phrases)) if (scalar(@phrases));
|
||||||
}
|
}
|
||||||
if ($rules->{creationDate}) {
|
if ($rules->{creationDate}) {
|
||||||
my $start = $rules->{creationDate}{start} || 0;
|
my $start = $rules->{creationDate}{start} || 0;
|
||||||
my $end = $rules->{creationDate}{end} || 9999999999999999999999;
|
my $end = $rules->{creationDate}{end} || 9999999999999999999999;
|
||||||
push(@clauses, "assetIndex.creationDate between ? and ?");
|
push(@clauses, "creationDate between ? and ?");
|
||||||
push(@params, $start, $end);
|
push(@params, $start, $end);
|
||||||
}
|
}
|
||||||
if ($rules->{revisionDate}) {
|
if ($rules->{revisionDate}) {
|
||||||
my $start = $rules->{revisionDate}{start} || 0;
|
my $start = $rules->{revisionDate}{start} || 0;
|
||||||
my $end = $rules->{revisionDate}{end} || 9999999999999999999999;
|
my $end = $rules->{revisionDate}{end} || 9999999999999999999999;
|
||||||
push(@clauses, "assetIndex.revisionDate between ? and ?");
|
push(@clauses, "revisionDate between ? and ?");
|
||||||
push(@params, $start, $end);
|
push(@params, $start, $end);
|
||||||
}
|
}
|
||||||
$self->{_params} = \@params;
|
$self->{_params} = \@params;
|
||||||
|
|
|
||||||
|
|
@ -131,10 +131,10 @@ sub create {
|
||||||
#-------------------- added by zxp end
|
#-------------------- added by zxp end
|
||||||
|
|
||||||
my $add = $self->session->db->prepare("insert into assetIndex (assetId, title, url, creationDate, revisionDate,
|
my $add = $self->session->db->prepare("insert into assetIndex (assetId, title, url, creationDate, revisionDate,
|
||||||
ownerUserId, groupIdView, groupIdEdit, className, synopsis, keywords) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
ownerUserId, groupIdView, groupIdEdit, lineage, className, synopsis, keywords) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )");
|
||||||
$add->execute([$asset->getId, $asset->get("title"), $asset->get("url"), $asset->get("creationDate"),
|
$add->execute([$asset->getId, $asset->get("title"), $asset->get("url"), $asset->get("creationDate"),
|
||||||
$asset->get("revisionDate"), $asset->get("ownerUserId"), $asset->get("groupIdView"), $asset->get("groupIdEdit"),
|
$asset->get("revisionDate"), $asset->get("ownerUserId"), $asset->get("groupIdView"), $asset->get("groupIdEdit"),
|
||||||
$asset->get("className"), $synopsis, $keywords]);
|
$asset->get("lineage"), $asset->get("className"), $synopsis, $keywords]);
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,10 @@ sub profileField {
|
||||||
$self = shift;
|
$self = shift;
|
||||||
$fieldName = shift;
|
$fieldName = shift;
|
||||||
$value = shift;
|
$value = shift;
|
||||||
die "No such profile field: $fieldName" unless $self->session->db->quickArray("SELECT COUNT(*) FROM userProfileField WHERE fieldName = ?", [$fieldName]);
|
if (!exists $self->{_profile}{$fieldName} && !$self->session->db->quickArray("SELECT COUNT(*) FROM userProfileField WHERE fieldName = ?", [$fieldName])) {
|
||||||
|
$self->session->warn("No such profile field: $fieldName");
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
if (defined $value) {
|
if (defined $value) {
|
||||||
$self->uncache;
|
$self->uncache;
|
||||||
$self->{_profile}{$fieldName} = $value;
|
$self->{_profile}{$fieldName} = $value;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue