[Zope-dev] Modifying Splitter.c to search on '+' & '#', and single letter words

Harry Wilkinson harryw@nipltd.com
Wed, 25 Jul 2001 18:01:11 +0100


Oh yes, I forgot the traceback of the error, so here it is:

Traceback (innermost last):
  File /stuff/harry/Zope-2.3.2-src/lib/python/ZPublisher/Publish.py, line
223, in publish_module
  File /stuff/harry/Zope-2.3.2-src/lib/python/ZPublisher/Publish.py, line
187, in publish
  File /stuff/harry/Zope-2.3.2-src/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
    (Object: Traversable)
  File /stuff/harry/Zope-2.3.2-src/lib/python/ZPublisher/Publish.py, line
171, in publish
  File /stuff/harry/Zope-2.3.2-src/lib/python/ZPublisher/mapply.py, line
160, in mapply
    (Object: TSrep)
  File /stuff/harry/Zope-2.3.2-src/lib/python/ZPublisher/Publish.py, line
112, in call_object
    (Object: TSrep)
  File /stuff/harry/Zope-2.3.2-src/lib/python/OFS/DTMLMethod.py, line 189,
in __call__
    (Object: TSrep)
  File /stuff/harry/Zope-2.3.2-src/lib/python/DocumentTemplate/DT_String.py,
line 538, in __call__
    (Object: TSrep)
  File /stuff/harry/Zope-2.3.2-src/lib/python/DocumentTemplate/DT_In.py,
line 484, in renderwb
    (Object: TestSplitter)
  File /stuff/harry/Zope-2.3.2-src/lib/python/Products/ZCatalog/ZCatalog.py,
line 535, in searchResults
    (Object: Traversable)
  File /stuff/harry/Zope-2.3.2-src/lib/python/Products/ZCatalog/Catalog.py,
line 657, in searchResults
  File /stuff/harry/Zope-2.3.2-src/lib/python/Products/ZCatalog/Catalog.py,
line 542, in _indexedSearch
  File /stuff/harry/Zope-2.3.2-src/lib/python/SearchIndex/UnTextIndex.py,
line 513, in _apply_index
  File /stuff/harry/Zope-2.3.2-src/lib/python/SearchIndex/UnTextIndex.py,
line 576, in query
  File /stuff/harry/Zope-2.3.2-src/lib/python/SearchIndex/UnTextIndex.py,
line 616, in evaluate
  File /stuff/harry/Zope-2.3.2-src/lib/python/SearchIndex/UnTextIndex.py,
line 446, in __getitem__
  File
/stuff/harry/Zope-2.3.2-src/lib/python/SearchIndex/GlobbingLexicon.py, line
224, in get
IndexError: (see above)


Harry Wilkinson wrote:

> I have two problems with getting ZCatalog to search for what I need:
>
> 1) Need to be able to search for words like 'J++' and 'C#'
>        - this is relatively simple to do by editing Splitter.c a little
> and recompiling
> 2) Need to be able to search for single-letter words like 'C'
>        - this is easy to modify Splitter.c to accomodate, but causes
> errors in GlobbingLexicon.py, even though the vocabulary is standard
>
> So far I have solved problem (1) by changing the contents of Splitter.c,
> but that's a bit messy.  Currently I don't know of an alternative
> though.
>
> I have modified Splitter.c so it indexes the extra characters, and
> reduced the mimimum word length to 1, which works fine when indexing,
> and I can see all the symbol-inclusive words and single-letter words in
> the vocabulary.  Unfortunately, any search on a single-letter word gives
> an IndexError, "String out of range".
>
> I am stuck on problem (2) and don't know how to avoid the errors arising
> in GlobbingLexicon.py without editing in some kind of hack to get around
> it.  I don't even know why GlobbingLexicon is getting involved in the
> search process since I am not trying to use wildcards and haven't
> elected to use a globbing vocabulary (AFAIK).
>
> Can anyone explain why GlobbingLexicon is involved?  Better yet, has
> anyone faced this problem (2) before, or come up with a more elegant
> solution to (1) ?
>
> Thanks for your help :)
>
> Harry
>
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )