Never mind. I figured out the problem by Apache's error log.

Thanks

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zhang,
Zhishuang
Sent: Friday, July 07, 2006 10:49 AM
To: [email protected]
Subject: [pylucene-dev] Python and CGI

I don't know it is appropriate to ask here. 
I am trying to build a web search engine for my website.

I am using Apache 2.2.0.

The problem is for the following code. 
On the result page I only see:
PyLucene 2.0.0 Lucene 2.0.0 
Line1  

Seems like anything after " searcher = IndexSearcher(directory)" this
line are ignored.

Involving the program in shell, the printing out is right.

Did anyone have the same problem before?


#!/usr/local/bin/python2.4
from PyLucene import QueryParser, IndexSearcher, StandardAnalyzer,
FSDirectory
from PyLucene import VERSION, LUCENE_VERSION
from PyLucene import Term, TermQuery

def search(searcher, analyzer, command):
        if command == '':
            return

        print
        print "Searching for:", command
        queryparser=QueryParser("contents",analyzer)
        
        query = queryparser.parse(command)
        hits = searcher.search(query)
        print "%s total matching documents." % hits.length()
        for i, doc in hits:
            print 'path:', doc.get("filename"), 'name:', doc.get("name")


print "Content-Type: text/html\n\n"
STORE_DIR = "index"
print 'PyLucene', VERSION, 'Lucene', LUCENE_VERSION
directory = FSDirectory.getDirectory(STORE_DIR, False)
print "<br>Line1"
searcher = IndexSearcher(directory)
print "<br>Line2"
analyzer = StandardAnalyzer()
search(searcher, analyzer, "unix")
searcher.close() 
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to