Skip Menu |

This queue is for tickets about the KinoSearch CPAN distribution.

Report information
The Basics
Id: 36826
Status: resolved
Priority: 0/
Queue: KinoSearch

People
Owner: Nobody in particular
Requestors: barborak [...] basikgroup.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.162
Fixed in: (no value)



Subject: problem with sample code
In the sample indexing code included in the synopsis for KinoSearch.pm (0.162), the hash %source_documents is not defined. As a result, nothing gets indexed and so the resulting search example fails. It would be nice to add something like the following to this code so that there is something to index and so the search code doesn't fail: my %source_documents = ( ( 'title', 'foo bar' ), ( 'title2', 'text' ) ); By the way, the error generated by the search script without this hash defined (and so with a degenerate index) is "Can't call method "create_weight" on an undefined value..." I suspect that this documentation issue is what spawned this thread I found while trying to work out my problem: http://www.rectangular.com/pipermail/kinosearch/2007-January/000658.html Best, Mike
While I appreciate the thoroughness of the sample code review, sacrificing completeness for brevity in the KinoSearch.pm synopsis documentation was a conscious choice. In point of fact, almost none of the synopsis samples taken from the KinoSearch suite will run by themselves. However, the user should be able to figure out how to modify the samples, as you were in this case. Hopefully it did not cost you too much time. Regards, Marvin Humphrey
From: barborak [...] basikgroup.com
Actually, it did take quite awhile to track down the problem as the first error I saw was in the search so I had to debug backwards from there to the real problem. I suppose if you wanted to define a functional bug rather than a documentation bug it would be that searching on an empty index throws a rather cryptic error. (KinoSearch::Searcher::get_field_names returns nothing which in turn causes KinoSearch::QueryParser::QueryParser::parse to return an undef for a simple query which in turn results in the error mentioned above.) I'm a little taken aback by your rejection of this bug as my citation shows that I'm not the first one to stumble on this issue. Maybe some background would convince you to edit your sample or to simply add a 'die "incomplete"' so that people won't mistakenly think these snippets aren't working samples. (This one addition makes them working samples, by the way.) The scenario is that I was battling to build the module on Windows. I did finally get it built but a majority of the tests failed. These failures had more to do with the Perl build process than the module so I just wanted a quick sanity test of what I built and then of the integrity of the module. (No reflection on you but many modules on CPAN are half built, half functional and unreviewed.) That's when I grabbed your sample code and ran into problems. With this one small change to a very salient example, I would have saved several hours. If it hadn't taken me so long and if I hadn't seen that someone else had had the same issue then I wouldn't have bothered to report it. It's your code and it appears to have been carefully crafted and documented so I won't presume to advise you, but if you choose not to make any changes, you might consider leaving this bug open so that others who encounter the issue might see it and ultimately save some time. I doubt that anyone would search through the rejected bugs for helpful hints. Best, Mike
Subject: Re: [rt.cpan.org #36826] problem with sample code
Date: Tue, 17 Jun 2008 17:51:57 -0700
To: bug-KinoSearch [...] rt.cpan.org
From: Marvin Humphrey <marvin [...] rectangular.com>
On Jun 17, 2008, at 4:58 PM, barborak@basikgroup.com via RT wrote: Show quoted text
> I suppose if you wanted to define a > functional bug rather than a documentation bug it would be that > searching on an empty index throws a rather cryptic error.
I agree that searching on an index which contains all the necessary files (indicating that an indexing session was completed) but has no documents should not produce that error message, so I will leave the ticket open. It would be better if the search simply returned no results. Show quoted text
> my citation shows that I'm not the first one to stumble on this issue.
To be honest, I didn't count that citation for much because the fellow in that thread turned out to be utterly incapable of troubleshooting on his own. He couldn't/wouldn't even troubleshoot module loading. :P Show quoted text
> Maybe some > background would convince you to edit your sample or to simply add a > 'die "incomplete"' so that people won't mistakenly think these > snippets > aren't working samples. (This one addition makes them working samples, > by the way.)
I'm sorry, but I value brevity greatly and I think that adding 'die "incomplete"' to each sample would add unacceptable irrelevant clutter. This is a fundamental philosophical difference of opinion between us, and it is not going to be resolved. If I am not mistaken, another thing that would have saved you is 'use strict;', since the %source_documents hash was never declared. I sympathize with the pain of your debugging session; all of us have spent such hours. However, if my deduction is correct, then I urge you to consider using 'strict' in the future, as it is designed to prevent precisely this kind of problem. Show quoted text
> I doubt that anyone would search through the rejected bugs for > helpful hints.
After the behavior is changed, I will mark it as "resolved". Best, Marvin Humphrey Rectangular Research http://www.rectangular.com/