Hi Marvin,
I found my bug, and it had nothing to do with what I wrote earlier. I
can verify that indeed
"please subscribe"
"please-subscribe"
please-subscribe
produce the same results, both in Lucy-0.1.0 as well as in KinoSearch 0.313.
The source of my bug was something completely different. I created an
environment object, msg_searcher, in which I stored my searcher, like
so: (Moose code)
has 'msg_searcher' => (
is => 'ro',
isa => 'KinoSearch::Search::IndexSearcher',
required => 1,
lazy => 1,
builder => '_build_searcher',
clearer => 'clear_searcher',
);
sub _build_searcher {
my $self = shift;
return KinoSearch::Search::IndexSearcher->new(
index => $self->message_storage,
);
}
I used an external script to see if the new message was in Kino in the
right way. In the external script, the object was freshly instantiated.
In the main program however, it was not, and because - as the
documentation says - "IndexSearchers operate against a single
point-in-time view or Snapshot of the index", I searched the Index as it
was before my changes. Now I added a call to $env->clear_searcher to
reinstantiate the searcher and it works.
Kind regards,
Arjan Widlak
United Knowledge
http://www.unitedknowledge.nl/
On 07/07/2011 01:47 AM, Marvin Humphrey wrote:
On Thu, Jul 07, 2011 at 01:35:30AM +0200, arjan wrote:
You asked how I build the query and this made have another look at how I
instantiate the QueryParser object. I selected the wrong fields.
Ah, interesting. :)
Thanks for asking the right questions and telling me how it should work.
Happy to help, and I'm glad you didn't find a Lucy bug! :)
For what it's worth, it's useful to know what kinds of mistakes our users
make, as it can help us to refine our API designs so that they shunt people
in the right direction. (See<http://wiki.apache.org/lucy/BrainLog>.)
In this case, I think we've already made QueryParser just about as safe as it
can be by having it take a Schema rather than a hard-coded list of fields by
default. I can't think of a way we could improve the design to spare future
users from the problems you faced.
They're in the lexicon? Do you mean that you've gone all the way down into
Lucy::Index::Lexicon, or something else?
Yes, like so:
my $polyreader = Lucy::Index::IndexReader->open(
index => $env->message_storage,
);
my $seg_readers = $polyreader->seg_readers;
foreach my $seg_reader ( @$seg_readers ) {
say "segment: $seg_reader";
my $lex_reader = $seg_reader->obtain( "Lucy::Index::LexiconReader" );
my $lexicon = $lex_reader->lexicon( field => 'title' );
while ( $lexicon->next ) {
say encode( 'utf8', $lexicon->get_term );
}
}
Nicely done! You obviously did your homework before coming to the list for
help...
Any help would be appreciated, or is this a bug?
How are you building/executing the query?
Ohhhhh....
LOL! Been there...
Good luck,
Marvin Humphrey
--
Recent: http://www.lomcongres.nl/
Congres- en nieuwsbriefportaal met relatiebeheer systeem voor het Landelijk
Overleg Milieuhandhaving
Setting Standards, a a Delft University of Technology and United Knowledge
simulation exercise on strategy and cooperation in standardization,
http://www.setting-standards.com
United Knowledge, internet voor de publieke sector
Keizersgracht 74
1015 CT Amsterdam
T +31 (0)20 52 18 300
F +31 (0)20 52 18 301
[email protected]
http://www.unitedknowledge.nl
M +31 (0)6 2427 1444
E [email protected]
Bezoek onze site op:
http://www.unitedknowledge.nl
Of bekijk een van onze projecten:
http://www.handhavingsportaal.nl/
http://www.setting-standards.com/
http://www.lomcongres.nl/
http://www.clubvanmaarssen.org/