: this to currently be a tricky situation.  My hack is just within the
: handleRequest method of the request handler and makes a second pass
: over the DocList and re-retrieves the Document objects to highlight
: them, and adds the highlighted text to additional XML elements in the
: response, not to the <doc>'s.  So my current hack is not worth
: contributing.

I disagree ... i think that's actually a pretty decent approach.

After the first burst of discussion on this thread, i remember thinking
that it would not only be hard to modify the XMLWriter, but also confusing
to know how to deal with it in the client -- the simplicity of the current
response in which a <str> is just a string would be broken -- now a <Str>
might have nested highlihgting information.

I also remember thinking that if highlighting was done "inline" then the
onus of finding good "snippets" would be left to the client.

I could have sworn i sent out another followup message about this, but i
can't find it now -- must have been one of those emaisl i composed in my
head while i was falling asleep and then forgot about.

I think having a seperate data payload containing highlighted snippets
(which may or may not be whole stored fields) really may be the best
approach. ... the question i was strugglig over was what format should
that data take: somethine new not currently possible, or something that
fits into the existing tag structure?

Something that might work is to add a list per doc in the DocList,
containing NamedLists where the names are fields the client wants
highlighted, each containing an list of "snippets" where each snippet is
an NamedList where the values are chunks of text in order, and the chunk
has a name if it should be highlighted

ie...

  <lst name="highlighting">
    <lst>  <!-- first doc in doclist -->
      <lst name="title"> <!-- first field w/highlighting -->
        <!-- may be multiple snippets per field -->
        <lst> <!-- first snippet -->
          <str>now is the time for </str>
          <str name="highlight">all good</str>
          <str> men to come to the</str>
        </lst>
        <lst><!-- second snippet -->
          ...
        </lst>
      </lst>
      <lst name="body"> <!-- second field w/highlighting -->
       ...
      </lst>
    </lst>
    <lst>  <!-- second doc in doclist -->
      ...
    </lst>
    ...

...it seems a little verbose, but it contains allows for arbitrary
highlighting of aritrary sized snippets, doesn't introduce any new
complexity to the XML Format (or XML Writing) and could be implimented
completely independently of the Documents themselves (so plugins could
fetch the text to be highlighted from external data)




-Hoss

Reply via email to