Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: kinosearch: discuss

KSx::Search::LongFieldSim in revision 3811

 

 

kinosearch discuss RSS feed   Index | Next | Previous | View Threaded


henka at cityweb

Sep 5, 2008, 4:11 AM

Post #1 of 8 (6549 views)
Permalink
KSx::Search::LongFieldSim in revision 3811

Greetings,

Testing KSx::Search::LongFieldSim in revision 3811 using the sample/
code, I've encountered the following error when creating an index:

Abstract method 'analyzer' not defined by USConSchema at
KinoSearch.xs:16574 XS_KinoSearch__Schema__analyzer
at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/KinoSearch.pm
line 307
KinoSearch::Schema::clobber('USConSchema', 'uscon_invindex')
called at ./invindexer.pl line 16

My changes were as follows:

USConSchema.pm:
---------------
package USConSchema::testfield;
use base 'KinoSearch::FieldSpec::text';
use KSx::Search::LongFieldSim;
sub similarity { KSx::Search::LongFieldSim->new }

...

our %fields = (
title => 'text',
content => 'text',
url => 'USConSchema::NotIndexed',
category => 'USConSchema::NotAnalyzed',
testfield => 'USConSchema::testfield',
);

invindexer.pl:
--------------
return {
title => $title_node->as_trimmed_text,
content => $bodytext_node->as_trimmed_text,
testfield => $bodytext_node->as_trimmed_text,
url => "/us_constitution/$filename",
category => $category,
};

Any comments on what I'm doing wrong are appreciated.

Cheers
henry

_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


marvin at rectangular

Sep 5, 2008, 6:54 AM

Post #2 of 8 (6282 views)
Permalink
Re: KSx::Search::LongFieldSim in revision 3811 [In reply to]

On Sep 5, 2008, at 4:11 AM, Henka wrote:

> Testing KSx::Search::LongFieldSim in revision 3811 using the sample/
> code, I've encountered the following error when creating an index:

At first glance, I don't see what's going wrong. Can you send me the
output of
"svn diff sample"?

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/


_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


henka at cityweb

Sep 5, 2008, 7:10 AM

Post #3 of 8 (6280 views)
Permalink
Re: KSx::Search::LongFieldSim in revision 3811 [In reply to]

Here's the diff for the schema and indexer.



--- sample-orig/USConSchema.pm 2008-09-03 14:43:11.000000000 +0200
+++ sample-longfield-sim/USConSchema.pm 2008-09-05 12:53:02.000000000 +0200
@@ -13,11 +13,18 @@
use base 'KinoSearch::Schema';
use KinoSearch::Analysis::PolyAnalyzer;

+package USConSchema::testfield;
+use base 'KinoSearch::FieldSpec::text';
+use KSx::Search::LongFieldSim;
+sub similarity { KSx::Search::LongFieldSim->new }
+
+
our %fields = (
- title => 'text',
- content => 'text',
- url => 'USConSchema::NotIndexed',
- category => 'USConSchema::NotAnalyzed',
+ title => 'text',
+ content => 'text',
+ url => 'USConSchema::NotIndexed',
+ category => 'USConSchema::NotAnalyzed',
+ testfield => 'USConSchema::testfield',
);

sub analyzer {


----------------------------------


--- sample-orig/invindexer.pl 2008-09-03 14:43:11.000000000 +0200
+++ sample-longfield-sim/invindexer.pl 2008-09-05 16:08:57.000000000 +0200
@@ -4,7 +4,7 @@

# Load configuration file. (Note: change conf.pl location as needed.)
my $conf;
-BEGIN { $conf = do "sample/conf.pl" or die "Can't locate conf.pl"; }
+BEGIN { $conf = do "./conf.pl" or die "Can't locate conf.pl"; }

use lib @{ $conf->{lib} };
use File::Spec::Functions qw( catfile );
@@ -49,10 +49,10 @@
: $filename =~ /preamble/ ? 'preamble'
: die "Can't derive category for $filename";
return {
- title => $title_node->as_trimmed_text,
- content => $bodytext_node->as_trimmed_text,
- url => "/us_constitution/$filename",
- category => $category,
+ title => $title_node->as_trimmed_text,
+ content => $bodytext_node->as_trimmed_text,
+ testfield => $bodytext_node->as_trimmed_text,
+ url => "/us_constitution/$filename",
+ category => $category,
};
}
-


_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


henka at cityweb

Sep 5, 2008, 7:16 AM

Post #4 of 8 (6282 views)
Permalink
Re: KSx::Search::LongFieldSim in revision 3811 [In reply to]

argh, I wasn't paying attention, here's the svn diff:

Index: sample/conf.pl
===================================================================
--- sample/conf.pl (revision 3813)
+++ sample/conf.pl (working copy)
@@ -11,5 +11,5 @@

# File system path to the directory which holds the US Constitution html
# files.
- uscon_source => 'sample/us_constitution',
+ uscon_source => 'us_constitution',
};
\ No newline at end of file
Index: sample/USConSchema.pm
===================================================================
--- sample/USConSchema.pm (revision 3813)
+++ sample/USConSchema.pm (working copy)
@@ -13,11 +13,18 @@
use base 'KinoSearch::Schema';
use KinoSearch::Analysis::PolyAnalyzer;

+package USConSchema::testfield;
+use base 'KinoSearch::FieldSpec::text';
+use KSx::Search::LongFieldSim;
+sub similarity { KSx::Search::LongFieldSim->new }
+
+
our %fields = (
- title => 'text',
- content => 'text',
- url => 'USConSchema::NotIndexed',
- category => 'USConSchema::NotAnalyzed',
+ title => 'text',
+ content => 'text',
+ url => 'USConSchema::NotIndexed',
+ category => 'USConSchema::NotAnalyzed',
+ testfield => 'USConSchema::testfield',
);

sub analyzer {
Index: sample/invindexer.pl
===================================================================
--- sample/invindexer.pl (revision 3813)
+++ sample/invindexer.pl (working copy)
@@ -4,7 +4,7 @@

# Load configuration file. (Note: change conf.pl location as needed.)
my $conf;
-BEGIN { $conf = do "sample/conf.pl" or die "Can't locate conf.pl"; }
+BEGIN { $conf = do "./conf.pl" or die "Can't locate conf.pl"; }

use lib @{ $conf->{lib} };
use File::Spec::Functions qw( catfile );
@@ -49,10 +49,10 @@
: $filename =~ /preamble/ ? 'preamble'
: die "Can't derive category for $filename";
return {
- title => $title_node->as_trimmed_text,
- content => $bodytext_node->as_trimmed_text,
- url => "/us_constitution/$filename",
- category => $category,
+ title => $title_node->as_trimmed_text,
+ content => $bodytext_node->as_trimmed_text,
+ testfield => $bodytext_node->as_trimmed_text,
+ url => "/us_constitution/$filename",
+ category => $category,
};
}
-
Index: sample/search.cgi
===================================================================
--- sample/search.cgi (revision 3813)
+++ sample/search.cgi (working copy)
@@ -1,12 +1,13 @@
-#!/usr/bin/perl -T
+#!/usr/bin/perl
use strict;
use warnings;

# Load configuration file. (Note: change conf.pl location as needed.)
-my $conf;
-BEGIN { $conf = do "./conf.pl" or die "Can't locate conf.pl"; }
-
-use lib @{ $conf->{lib} };
+#my $conf;
+#BEGIN { $conf = do "/www/sites/testsite/htdocs/test/sample/conf.pl"
or die "Can't locate conf.pl"; }
+#
+use lib '/www/sites/testsite/htdocs/testing/sample-longfield-sim';
+#use lib @{ $conf->{lib} };
use CGI;
use Data::Pageset;
use HTML::Entities qw( encode_entities );
@@ -21,7 +22,7 @@

# Create a Searcher object and feed it a query.
my $searcher = KinoSearch::Searcher->new(
- invindex => USConSchema->open( $conf->{path_to_invindex} ) );
+ invindex => USConSchema->open(
'/www/sites/testsite/htdocs/testing/sample-longfield-sim/uscon_invindex' )
);
my $hits = $searcher->search(
query => $q,
offset => $offset,


_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


marvin at rectangular

Sep 5, 2008, 9:08 AM

Post #5 of 8 (6296 views)
Permalink
Re: KSx::Search::LongFieldSim in revision 3811 [In reply to]

Henry,

> here's the svn diff:
>
> Index: sample/conf.pl
> ===================================================================
> --- sample/conf.pl (revision 3813)
> +++ sample/conf.pl (working copy)
> @@ -11,5 +11,5 @@


Sorry to ask for this again, but can you send the diff as an
attachment? I tried extracting it from the email and copying/pasting
from the web archive of the list, but I wasn't able to produce
something that would patch cleanly.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/

_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


henka at cityweb

Sep 5, 2008, 12:08 PM

Post #6 of 8 (6285 views)
Permalink
Re: KSx::Search::LongFieldSim in revision 3811 [In reply to]

Quoting "Marvin Humphrey" <marvin [at] rectangular>:
> Sorry to ask for this again, but can you send the diff as an
> attachment? I tried extracting it from the email and
> copying/pasting from the web archive of the list, but I wasn't able
> to produce something that would patch cleanly.

no problemo, see attachment.
Attachments: sample.diff (3.27 KB)


marvin at rectangular

Sep 8, 2008, 5:25 AM

Post #7 of 8 (6268 views)
Permalink
Re: KSx::Search::LongFieldSim in revision 3811 [In reply to]

On Sep 5, 2008, at 12:08 PM, Henka wrote:

> Quoting "Marvin Humphrey" <marvin [at] rectangular>:
>> Sorry to ask for this again, but can you send the diff as an
>> attachment? I tried extracting it from the email and copying/
>> pasting from the web archive of the list, but I wasn't able to
>> produce something that would patch cleanly.
>
> no problemo, see attachment.
>
> <sample.diff>

Thanks, this was easier to see from the patched Schema file than it
would have been from a diff. The problem is simply transposition of
lines: the way the new USConSchema::testfield package was declared, it
interrupted USConSchema and took over its analyzer() sub.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/


_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


henka at cityweb

Sep 9, 2008, 6:43 AM

Post #8 of 8 (6276 views)
Permalink
Re: KSx::Search::LongFieldSim in revision 3811 [In reply to]

Quoting "Marvin Humphrey" <marvin [at] rectangular>:
> Thanks, this was easier to see from the patched Schema file than it
> would have been from a diff. The problem is simply transposition of
> lines: the way the new USConSchema::testfield package was declared,
> it interrupted USConSchema and took over its analyzer() sub.

Sorry for delay in responding -- been away from the set of tubes.

Thanks for pointing out my error!

Regards
Henry


_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch

kinosearch discuss RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.