Menu

#18 Search term highlighting

open
5
2010-07-27
2010-07-09
Bob Weigel
No

Document what is required to do search term highlighting (like on exist demo page) on returned search results.

Demo page: http://ec2-174-129-50-195.compute-1.amazonaws.com:8088/exist/sandbox/sandbox.xql
chose first option in drop-down.

Discussion

  • Dmitry Y Mishin

    Dmitry Y Mishin - 2010-07-14

    Index configuration for Shakespeare section:

    <index>
    <fulltext default="none" attributes="no"/>
    <lucene>
    <text qname="SPEECH">
    <ignore qname="SPEAKER"/>
    </text>
    <text qname="TITLE"/>
    </lucene>
    <ngram qname="SPEAKER"/>
    </index>

    Using this index, you can use ft:query(., 'love') function from the example with syntax hi-lighting.

     
  • Dmitry Y Mishin

    Dmitry Y Mishin - 2010-07-14
    • status: open --> pending
     
  • Bob Weigel

    Bob Weigel - 2010-07-14

    I think that the issue is more complex with VxOware. A search typically returns a list of matching documents with only their Title and Description wrapped in a special results XML structure. Suppose the Title or Description contained a match. How would it get highlighted (what code would need to be modified, etc.)? Exist uses a different XML structure for the search results to indicate words that matched, as in <match>love</match> and then a post-process converts this to html.

    The next level of usability would be for the last search term to be stored internally so that when a user looks at the full body of a matching document following a search, they see highlighted terms.

     
  • Bob Weigel

    Bob Weigel - 2010-07-14
    • status: pending --> open
     
  • Dmitry Y Mishin

    Dmitry Y Mishin - 2010-07-15
    • status: open --> pending
     
  • Dmitry Y Mishin

    Dmitry Y Mishin - 2010-07-15

    To highlight the term in futher documents, we can include it in every request (needs a special field in each form), or, better way, store it in a user session attribute. Then we should figure out the way to disable highlighting.

    The highlight can be done using javascript on the page.

    The easiest way is including a javascript to all the pages and always highlighting a term if there is a term attribute in user session.

     
  • Bob Weigel

    Bob Weigel - 2010-07-27

    Leaving request as open for now. Will revisit later.

     
  • Bob Weigel

    Bob Weigel - 2010-07-27
    • status: pending --> open
     
MongoDB Logo MongoDB