When I try the following test code with the WildcardQuery, things work fine - but if I try witha simple proxy class to WildcardQuery, I get an exception.

My test case:

     47     def test_wildcard(self):
     48         directory = RAMDirectory()
     49         writer = IndexWriter(directory, WhitespaceAnalyzer(), True)
     50         self._addDoc("victor", writer)
     51         self._addDoc("vector", writer)
     52         writer.optimize()
     53         writer.close()
     54
     55         searcher = IndexSearcher(directory)
     56
     57         query = WildcardQuery(Term("field", "v*"))
     58         hits = searcher.search(query)
     59         print "\n\n%s hits found!\n\n" % hits.length()

My simple proxy class:

    162 class PyWildcardQuery(object):
    163     '''
    164     This class just proxies everything to
    165     PyLucene.WildCardQuery
    166     but doesn't seem to work
    167     '''
    168
    169     def __init__(self, term):
    170         self.wc = WildcardQuery(term)
    171
    172     def __getattr__(self, key):
    173         return getattr(self.wc, key)

My exception if I change line 57 in the test to use PyWildcardQuery is:

InvalidArgsError: (<type ' PyLucene.IndexSearcher'>, 'setSort', (<pyldemo.PyWildcardQuery object at 0xb7b3e38c>,))




On 4/19/06, Victor Ng < [EMAIL PROTECTED]> wrote:
Hi all,

I'm having trouble trying to get PyLucene working with a custom class that is supposed to be extending MultiTermQuery.

Is there a working example somewhere?  I can't seem to find an example in the samples or test suite from PyLucene 2.0rc1-7.

vic

--
"Never attribute to malice that which can be adequately explained by stupidity."  - Hanlon's Razor



--
"Never attribute to malice that which can be adequately explained by stupidity."  - Hanlon's Razor
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to