Jim Lynch
2006-Jan-06 16:39 UTC
[Xapian-discuss] Trying to get omegascript configured to support multiple dbs
I made the following changes to the query template. Hoping that it would let me select from a couple of databases. <INPUT NAME=P VALUE="$html{$query}" SIZE=65> <INPUT TYPE=SUBMIT VALUE="Search" BORDER=0> <hr> <input type="checkbox" name="DB" value="default" $if{$eq{$cgi{DB},default},CHECKED} > Default<br> <input type="checkbox" name="DB" value="tst.db" $if{$eq{$cgi{DB},tst.db},CHECKED} > Test<br> <hr> Well it does sort of. Two problems. It always looks for the default even if I've got it unchecked. The other problem is if I have both of them checked, when I return from the query, it resets the test checkbox. I suspect that's because the cgi parameter, DB is a list and I don't know how to say "if tst.db is in the DB list, then ...". Suggestions? Thanks, Jim.
Olly Betts
2006-Jan-06 17:19 UTC
[Xapian-discuss] Trying to get omegascript configured to support multiple dbs
On Fri, Jan 06, 2006 at 11:40:52AM -0500, Jim Lynch wrote:> Well it does sort of. Two problems. It always looks for the default > even if I've got it unchecked. The other problem is if I have both of > them checked, when I return from the query, it resets the test > checkbox. I suspect that's because the cgi parameter, DB is a list and > I don't know how to say "if tst.db is in the DB list, then ...".Note that $cgi{DB} will pick an arbitrary DB parameter if there's more than one. You want $cgilist{DB} which will return all the values, as a tab-separated list. But there's no obvious way to see if a list contains a particular value which is what you then need to be able to do. Something like $find{LIST,STRING} to return the offset into the list, or the empty string if not present. I'll see if I can manage to implement that before the next release. A related issue to bear in mind is what happens if there's no DB parameter (in which case Omega will search the database "default"). Cheers, Olly