Excalibur Blade data returns
Posted in 2013
Topics: Server Administration, Platform-Specific Issues
Hi All,
The Excalibur blade is rarely discussed here, but I see some recent posts, so
I'm hoping someone is using it and can offer assistance.
We are storing Word docs in our database (Informix 11.5.FC5 running on Solaris
10) and are attempting to use the Excalibur blade to search and retrieve
specific documents. We also have a requirement to only present 25 words before
and after the "queried" word.
The index seems to be working correctly. I created it using Filtering:
create index contst_word_idx on content_tst
(cont_tst_blb etx_blob_ops) using etx (filter='CONTINUE_ON_ERROR'
, phrase_support='MAXIMUM') in smartspace;
The documentation claims that etx_GetHilite will return a filtered doc in the
viewer_doc field if the index is created with filtering. However, when running
the query via dbaccess, I am returned "<SBlob Data>" instead of the filtered
document. etx_HiliteDoc returns the same result.
Also, the vec_offset seems to be a value pertaining to the *unfiltered*
document.
If I run etx_viewHilite, I am returned a filtered document, but the doc is cut
off at 41000 characters. (I set the environment variable ETX_HILITE_MAXLEN to
100000, to no avail :-( ).
Questions:
(a) What changes are needed to get etx_GetHilite to return a filtered doc in
its viewer.doc field?
(b) Is there a way to substring the return, so only 50 characters before and
after the vec_offset are shown?
Some of our docs are several MB large and we're hoping to use the blade
instead of parsing the doc.
BTW, the query I am testing with is:
select
etx_GetHilite(etx_filter(cont_tst_blb), rc).vec_offset,
etx_ViewHilite(etx_GetHilite(cont_tst_blb, rc),'<b>','</b>'),
etx_HiliteDoc(cont_tst_blb, 'contst_word_idx',
ROW('manufacture', 'SEARCH_TYPE = PHRASE_APPROX')).viewer_doc
from content_tst
where etx_contains (cont_tst_blb, ROW('manufacture', 'SEARCH_TYPE =
PHRASE_APPROX'), rc # etx_ReturnType)
Thanks for any and all assistance!
Michael Hoffman
Hi Michael, I am glad to help here. (a) What changes are needed to get etx_GetHilite to return a filtered doc in its viewer.doc field? Yes, i.e. etx_viewhilite(etx_gethilite(doc, rt), '[', ']') should give you the text content of the doc. For longer than 32767, set environment variable to bigger number. i.e. setenv ETX_HILITE_MAXLEN 200000, be sure to bounce the server in order to get this variable effective in the server. (b) Is there a way to substring the return, so only 50 characters before and after the vec_offset are shown? The vec_offset will give the pair of each hit, i.e. search for "Excalibur" in User's Guide, would get: 88 9 184 9 2539 9 2671 9 ... The following will give the string nearby 184th: substr(etx_viewhilite(etx_gethilite(doc, rt), '[', ']'), 130, 100) NOTE: substr has limitation on index parameter. So it is better to use program ESQL or C to process that, fetch data from vec_offset and use ifx_lo_open() and ifx_lo_read, or mi_lo_open and mi_lo_read() to locate the position in viewer_doc and fetch the string around that position and display. These are described in ESQL/C Manual and DataBlade API manual. Not sure if this answer your question. --weiming