advice needed: highlights from other field

26 views
Skip to first unread message

Tomas Dobrotka

unread,
Mar 5, 2021, 5:13:00 AM3/5/21
to Whoosh
Helo,

I would like to ask for advice with, "highlights".
In my application I store two versions of text data, that I later use for searching.

Let say, I use these two fields:
- "content" - << Used for query search.

- "texts_from_html" <<< Like to use this for displaying highlight/excerpt.

(both fields do contain practically the same text content and are "stored")

MY PROBLEM IS:
the .highlight() function is only returning text when used with  "content" field.
I like to do Query search for the field "content" but display the DOC.highlights() for the the field "texts_from_html"

Thank for advice, if possible.

---------My Search -------
qp = QueryParser("content", schema=ix.schema)
query = qp.parse("text to search")
data=searcher.search_page(query,pagenum=page,pagelen=pagelen)


----------------My Schema ------------------
index_schema = Schema(
      url=TEXT(stored=True),
      title=TEXT(stored=True),
      content=TEXT(stored=True),
      texts_from_html=TEXT(stored=True),
      image=TEXT(stored=True),
)

Thanks

Reply all
Reply to author
Forward
0 new messages