the search engine, it works!!!
This commit is contained in:
parent
66baa5cea2
commit
e33b3bb9b9
7 changed files with 135 additions and 16 deletions
|
|
@ -993,7 +993,9 @@ Returns an indexer object for this asset. When this method is called the asset's
|
|||
|
||||
sub indexContent {
|
||||
my $self = shift;
|
||||
return WebGUI::Search::Index->create($self);
|
||||
my $indexer = WebGUI::Search::Index->create($self);
|
||||
$indexer->setIsPublic(0) if ($self->getId eq "PBasset000000000000001");
|
||||
return $indexer;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ Retrieves a value from a form GET or POST and returns it. If the value comes bac
|
|||
|
||||
sub getValueFromPost {
|
||||
my $self = shift;
|
||||
my $formValue = $self->session->request->param($self->get("name"));
|
||||
my $formValue = $self->session->request->param($self->get("name")) if ($self->session->request);
|
||||
if (defined $formValue) {
|
||||
return $formValue;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -48,9 +48,11 @@ Returns an array reference containing all the asset ids of the assets that match
|
|||
|
||||
sub getAssetIds {
|
||||
my $self = shift;
|
||||
my $query = "select assetId from assetIndex where isPublic=? and (".$self->{_query}.")";
|
||||
my $rs = $self->session->db->prepare($self->{_query});
|
||||
$rs->execute([$self->{_isPublic},@{$self->{_params}}]);
|
||||
my $query = "select assetId from assetIndex where ";
|
||||
$query .= "isPublic=1 and " if ($self->{_isPublic});
|
||||
$query .= "(".$self->{_query}.")";
|
||||
my $rs = $self->session->db->prepare($query);
|
||||
$rs->execute($self->{_params});
|
||||
my @ids = ();
|
||||
while (my ($id) = $rs->array) {
|
||||
push(@ids, $id);
|
||||
|
|
@ -69,9 +71,11 @@ Returns an array reference containing asset objects for those that matched.
|
|||
|
||||
sub getAssets {
|
||||
my $self = shift;
|
||||
my $query = "select assetId,className,revisionDate from assetIndex where isPublic=? and (".$self->{_query}.")";
|
||||
my $rs = $self->session->db->prepare($self->{_query});
|
||||
$rs->execute([$self->{_isPublic},@{$self->{_params}}]);
|
||||
my $query = "select assetId,className,revisionDate from assetIndex where ";
|
||||
$query .= "isPublic=1 and " if ($self->{_isPublic});
|
||||
$query .= "(".$self->{_query}.")";
|
||||
my $rs = $self->session->db->prepare($query);
|
||||
$rs->execute($self->{_params});
|
||||
my @assets;
|
||||
while (my ($id, $class, $version) = $rs->array) {
|
||||
push(@assets, WebGUI::Asset->new($id, $class, $version));
|
||||
|
|
@ -90,10 +94,11 @@ Returns a WebGUI::SQL::ResultSet object containing the search results with colum
|
|||
|
||||
sub getResultSet {
|
||||
my $self = shift;
|
||||
my $query = "select assetId, title, url, synopsis, ownerUserId, groupIdView, groupIdEdit, creationDate, revisionDate, className
|
||||
from assetIndex where isPublic=? and (".$self->{_query}.")";
|
||||
my $rs = $self->session->db->prepare($self->{_query});
|
||||
$rs->execute([$self->{_isPublic},@{$self->{_params}}]);
|
||||
my $query = "select assetId, title, url, synopsis, ownerUserId, groupIdView, groupIdEdit, creationDate, revisionDate, className from assetIndex where ";
|
||||
$query .= "isPublic=1 and " if ($self->{_isPublic});
|
||||
$query .= "(".$self->{_query}.")";
|
||||
my $rs = $self->session->db->prepare($query);
|
||||
$rs->execute($self->{_params});
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ package WebGUI::Search::Index;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -113,7 +112,7 @@ sub create {
|
|||
my $description = WebGUI::HTML::filter($asset->get('description'), "all");
|
||||
my $keywords = join(" ",$asset->get("title"), $asset->get("menuTitle"), $asset->get("synopsis"), $url, $description);
|
||||
my $add = $self->session->db->prepare("insert into assetIndex (assetId, title, url, creationDate, revisionDate,
|
||||
ownerUserId, groupIdView, groupIdEdit, lineage, 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"),
|
||||
$asset->get("revisionDate"), $asset->get("ownerUserId"), $asset->get("groupIdView"), $asset->get("groupIdEdit"),
|
||||
$asset->get("lineage"), $asset->get("className"), $asset->get("synopsis"), $keywords]);
|
||||
|
|
@ -169,7 +168,7 @@ Sets the status of whether this asset will appear in public searches.
|
|||
|
||||
=cut
|
||||
|
||||
sub isPublic {
|
||||
sub setIsPublic {
|
||||
my $self = shift;
|
||||
my $boolean = shift;
|
||||
my $set = $self->session->db->prepare("update assetIndex set isPublic=? where assetId=?");
|
||||
|
|
@ -192,7 +191,7 @@ sub new {
|
|||
my $class = shift;
|
||||
my $asset = shift;
|
||||
my $self = {_asset=>$asset, _session=>$asset->session, _id=>$asset->getId};
|
||||
return $self;
|
||||
bless $self;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue