[Zope] ZCatalog: TextIndex and numbers

sean.upton@uniontrib.com sean.upton@uniontrib.com
Fri, 13 Sep 2002 10:51:27 -0700


Or, you could simply change isalpha to isalnum and recompile.

-----Original Message-----
From: Casey Duncan [mailto:casey@zope.com]
Sent: Friday, September 13, 2002 9:11 AM
To: vsbabu@vsbabu.org; zope@zope.org
Subject: Re: [Zope] ZCatalog: TextIndex and numbers


The splitter (which is written in C for textindex) omits numbers. The code 
that does this can be easily commented out though. Specifically this section

of 
{Zope}/lib/python/Products/PlugInIndexes/TextIndex/Splitter/ZopeSplitter/src
/ZopeSplitter.c

    /*************************************************************
      Test whether a word has any letters.                       *
                                                                 */
    for (; --len >= 0 && ! isalpha((unsigned char)cword[len]); )
        ;
    if (len < 0 && ! self->index_numbers) {
        Py_INCREF(Py_None);
        return Py_None;
    }

    /*
     * If no letters, treat it as a stop word.
     *************************************************************/

Comment this out and a recompile, restart and reindex will get the numbers 
indexed.

ZCTextIndex in Zope 2.6 indexes numbers by default (Hands waving in air ;^).

hth,

-Casey

On Friday 13 September 2002 11:30 am, vsbabu@vsbabu.org wrote:
> Hello,
> 
> I've a TextIndex on title (Zope 2.5.0). When the title has a value
> 
> "Restoration Discretionary Programs--Sections 1135, 204, and 206"
> 
> The index has the value 
> ('restoration', 'and', 'programssections', 'discretionary') 
> 
> As you can see 1135, 204, 206 are not in the index. Is there a quick way
> to get ZCatalog to consider all words for indexing?
> 
> Thanks
> 
> -vsb
> http://vsbabu.org/
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )