[Zope-dev] Wildcards in TextIndex query. Do they work?

Michel Pelletier michel@digicool.com
Thu, 24 May 2001 14:37:09 -0700 (PDT)


On Thu, 24 May 2001, Erik Enge wrote:

> On Thu, 24 May 2001, Michel Pelletier wrote:
> 
> > If the first works, then you are using a globbing vocabulary.  The
> > second one should work, but maybe there is a bug.  Or perhaps your
> > search criteria is so strict that you are getting no results.
> 
> Hm.  Something isn't right here.

I don't think you are using a globbing vocabulary.

> This:
>   
>    eric
> 
> got me 70 hits.
> 
> This:
> 
>    eri?
> 
> got me 4 hits.

If you are not using a glob vocab, I suspect it stripped out the ? and is
hitting on 'eri'.  Do you have that word anywhere?

> That's a bit strange, if you ask me :)
> 
> This:
> 
>    (erik) and (enge)
> 
> returned 1 hit
> 
> This:
> 
>    (erik) and (eng?)
> 
> gave me none.

Which could make sense if you were not using a glob vocab.

> The first one looked like this after the parsers had nibbled on it:
> 
>   [['erik'], 'and', ['enge']]
> 
> And the latter one:
> 
>   [['erik'], 'and', ['eng?']]

This one should look like [['erik'], 'and', ['enge', 'engs', 'engf',
...]] and match all the words that match the pattern eng?.  If this isn't
being expanded, then you are not using a globbing vocabulary.

Then again, where did you get these objects?  If you were looking at the
wrong point in the code, the wildcards may not have been expanded yet.

> 
>  [['erik', '...', '...', '...', 'enge']]

Where do you see this?

> Where should I look next to figure out what's going on?

Make sure you are using a globbing vocab.  Note that you can't change a
catalog's vocabulary once the catalog is made, so you have to make a new
catalog.

> > > I can't see that the query-parsers in UnTextIndex.py transforms them
> > > differently, but I might be missing something obvious.
> > 
> > There's _nothing_ obvious in that particular chunk of code.
> 
> Good, then it's just not me.  Is the overall design philosophy for
> ZCatalog/Catalog/SearchIndex documented anywhere?

The catalog has evolved over the past four years.  Most of the text index
query parser code was written by someone long gone from this company, and
certainly way before my time.  The catalog is, in fact, the evolution of a
completely different product called ZTables, now long dead in the annals
of Principia history. 

This person did not document their design, so the answer is no.  I had
some UML models once, but my modeling tool ate them.

>  (By the way, from
> lib/python/SearchIndex/TextIndex.py, what is sws and cv3?)

Very old consulting projects, looooong dead.

-Michel