[sword-devel] indexed search discrepancy (minor search.cpp patch)
jmarsden at fastmail.fm
Sun Aug 30 18:46:31 MST 2009
I proposed a patch permitting:
>> SEARCH_TYPE=-4 ./search KJV "swift hear slow speak"
Matthew Talbert responded:
> Wouldn't it be more consistent with the other utilities to have it as
> an argument rather than using the environment variable? I've nothing
> against it myself, but perhaps it would be better to have consistency.
Yes, it would. However, the code for search.cpp does not use getopt(3)
or its C++ equivalent, for some reason. Instead, the code uses the
third and fourth arguments as sort of pseudo-switches, I think, and so
has multiple tests on the value of argc. I don't know why it was done
that way, so rather than risk introducing bugs by reworking that, I just
avoided the issue, and left the argument parsing completely alone :)
> Also, something I thought of later, is that it would probably be
> trivial to add indexed search capability to diatheke. I don't know
> which would be more valuable for use in a test script.
I don't know which is more valuable for testing either, but yes, adding
indexed search to diatheke would be good, IMO. I thought about it
briefly, but the search.cpp codebase is an order of magnitude smaller
than the diatheke codebase, and so easier for me to see exactly where
and how to modify... so I went for the quick fix, at least for now. A
small patch to diatheke to add indexed search would (I hope!) probably
be accepted, even though diatheke is officially "no longer actively
being developed" per http://crosswire.org/wiki/ .
More information about the sword-devel