Remove stubs of search system; these didn't actually do anything.
Patch by denise.
diffs (218 lines):
diff -r 099ca66be790 -r 405f9bcfe713 cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm Sat Jul 11 07:56:26 2009 +0000
+++ b/cgi-bin/LJ/Entry.pm Sat Jul 11 08:01:53 2009 +0000
@@ -937,37 +937,6 @@ sub can_tellafriend {
return 0 unless $entry->journal->is_person;
return 0 unless LJ::u_equals($u, $entry->poster);
return 1;
-}
-
-sub search_index_id {
- my $entry = shift;
-
- return 'entry_' . $entry->journalid . '_' . $entry->jitemid;
-}
-
-sub search_document {
- my $entry = shift;
-
- my $content = $entry->subject_text . ' ' . $entry->event_text;
-
- # append log metadata to end of content
- my $metadata = '';
-
- my $mood = $entry->prop('current_mood') ||
LJ::mood_name($entry->prop('current_moodid')) || '';
- $content .= "\n$mood\n";
-
- # add location and music
- $content .= join("\n", map { $entry->prop($_) } qw/current_location
current_music/);
-
- my $doc = LJ::Search->document(
- id => $entry->search_index_id,
- content => $content,
- date => $entry->logtime_unix,
- );
-
- $doc->stored('id', 1); # store the id field and index it
-
- return $doc;
}
# defined by the entry poster
diff -r 099ca66be790 -r 405f9bcfe713 cgi-bin/LJ/EventLogSink/SearchIndexer.pm
--- a/cgi-bin/LJ/EventLogSink/SearchIndexer.pm Sat Jul 11 07:56:26 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-package LJ::EventLogSink::SearchIndexer;
-use strict;
-use base 'LJ::EventLogSink';
-
-use Class::Autouse qw/
- LJ::Search
- /;
-
-our @EVENT_TYPES = qw(new_entry new_comment edit_entry delete_comment);
-
-sub new {
- my ($class, %opts) = @_;
-
- my $self = {};
-
- bless $self, $class;
- return $self;
-}
-
-sub should_log {
- my ($self, $evt) = @_;
- my $type = $evt->event_type;
-
- # don't search unless we have a client object
- return 0 unless LJ::Search->client;
-
- return grep { $_ eq $type }
- @LJ::EventLogSink::SearchIndexer::EVENT_TYPES;
-}
-
-sub log {
- my ($self, $evt) = @_;
-
- my %handlers = (
- new_entry => \&index_new_entry,
- new_comment => \&index_new_comment,
- edit_entry => \&index_edit_entry,
- delete_comment => \&index_delete_comment,
- );
-
- my $handler = $handlers{$evt->event_type}
- or die "No handler found for event type " . $evt->event_type;
-
- $handler->($evt);
-
- return 1;
-}
-
-sub index_new_entry {
- my $evt = shift;
-
- my $info = $evt->params or return 0;
- my $entry = LJ::Entry->new($info->{'journal.userid'},
- ditemid => $info->{ditemid});
-
- LJ::Search->client->index($entry->search_document);
-}
-
-sub index_edit_entry {
- my $evt = shift;
-
- my $info = $evt->params or return 0;
- my $entry = LJ::Entry->new($info->{'journalid'},
- jitemid => $info->{jitemid});
-
- LJ::Search->client->replace($entry->search_document);
-}
-
-sub index_new_comment {
- my $evt = shift;
-
- my $info = $evt->params or return 0;
- my $cmt = LJ::Comment->new($info->{'journal.userid'},
- jtalkid => $info->{jtalkid});
-
- LJ::Search->client->update(id => $cmt->search_index_id,
$cmt->search_document);
-}
-
-sub index_delete_comment {
- my $evt = shift;
-
- my $info = $evt->params or return 0;
- my $cmt = LJ::Comment->new($info->{'journalid'},
- jtalkid => $info->{jtalkid});
-
- LJ::Search->client->delete(id => $cmt->search_index_id);
-}
-
-1;
diff -r 099ca66be790 -r 405f9bcfe713 cgi-bin/LJ/Search.pm
--- a/cgi-bin/LJ/Search.pm Sat Jul 11 07:56:26 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-package LJ::Search;
-use strict;
-use Carp qw (croak);
-
-our $searcher;
-
-# returns a search client
-sub client {
- my ($class) = @_;
-
- unless ($searcher) {
- $searcher = LJ::run_hook("content_search_client");
- }
-
- return $searcher;
-}
-
-# returns a new document with the data in %opts
-sub document {
- my ($class, %opts) = @_;
-
- return LJ::run_hook("content_search_document", %opts);
-}
-
-1;
-
-
diff -r 099ca66be790 -r 405f9bcfe713 cgi-bin/LJ/Search/Client.pm
--- a/cgi-bin/LJ/Search/Client.pm Sat Jul 11 07:56:26 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-package LJ::Search::Client;
-use strict;
-use Carp qw ( croak );
-
-# This is a placeholder class; the real search client class will be
-# loaded by the content_search_client hook.
-
-sub new {
- croak "Tried to instantiate LJ::Search::Client base class";
-}
-
-1;
diff -r 099ca66be790 -r 405f9bcfe713 cgi-bin/LJ/Search/Document.pm
--- a/cgi-bin/LJ/Search/Document.pm Sat Jul 11 07:56:26 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-package LJ::Search::Document;
-use strict;
-use Carp qw ( croak );
-
-# This represents a search document. Search document subclasses should
-# be returned by the content_search_document hook.
-
-sub new {
- croak "Tried to instantiate LJ::Search::Client base class";
-}
-
-# id of document
-sub id {}
-
-# body of document
-sub body {}
-
-# date of document
-sub date {}
-
-# subject of document
-sub subject {}
-
-# list of fields in the document
-sub fields {}
-
-# returns if a field is a date field
-sub is_date {}
-
-# boost $field, $value
-sub boost {}
-
-1;
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog