[Tutor] SwishE web interface
Glen Wheeler
gew75 at hotmail.com
Tue Jun 8 11:09:53 EDT 2004
Hi Reed,
Not exactly sure what you're asking, but would this help?
def search(searchWords):
# make sure the user provided all the parameters
if not (searchWords):
return " Nothing to search for. Nothing Found."
handle = SwishE.new('/usr/local/swish-e/index.swish-e')
search = handle.search('')
results = search.execute(searchWords)
allHits = []
while (hits = results.hits()):
allHits.append(hits)
return allHits
Then you'd have a list with all the _.hits() in it? If there is more than
one `hit' to return, then there must be some way of terminating the loop, so
I have just assumed that each call to hits() is similar to pop() -- takes
the current hit off the top and deletes it from the list.
Sorry that I can't be any more use, I've never used SwishE before.
Glen
----- Original Message -----
From: "Reed L. O'Brien" <reedobrien at acm.org>
To: <tutor at python.org>
Sent: Wednesday, June 09, 2004 12:20 AM
Subject: [Tutor] SwishE web interface
> I have an html page whose form calls the function in the following.
>
> import SwishE
>
>
>
>
> def search(searchWords):
>
>
> # make sure the user provided all the parameters
> if not (searchWords):
> return " Nothing to search for. Nothing Found."
>
> handle = SwishE.new('/usr/local/swish-e/index.swish-e')
> search = handle.search('')
> results = search.execute(searchWords)
> # return results.hits()
> for r in results:
> return r.getproperty('searchdocpath')
>
> If I:
> return results.hits()
>
> but
> for r in results:
> return r.getproperty('searchdocpath')
>
> only returns the first. I would like them all returned. I have been
> playing around but am in a loop. Any help would be appreciated. I know
> it is a simple solution like converting to a dict or something. I am
> humbled by the difficulty of programming. This is my first non shell
> script.
>
> FreeBSD 5.2.1
> apache 2.0.49
> mod_python 3.1.3
> SwishE 0.4
>
> TIA
> --
>
>
> reed
> 4.6692016090
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list