Highlight encoder


(Guozhu Wei) #1

Dear all

Happy new year!

I have a problem when I use the highlight, I want to highlight a field
'abs' while it contains html, like:

the content of field 'abs':
... The molecule:(L2L3M)n ...

I want to escape the html when highlight and found that the "encoder" option.

I use this option:

"highlight": {
    "escape_html": "html",
    "pre_tags": ["<strong><span class=\"text-danger\">"],
    "post_tags": ["</span></strong>"],
    "fields": {
        "abs": {
            "fragment_size": 150,
            "number_of_fragments": 1,
            "no_match_size": 150
        }
    }
},

but nothing changed, the html tags like '' still returned untouched.

Any hints of what could be wrong?

Thanks!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CANnJ_2ObfTrUa9fvb2hkB0wNhSaPw5u9fSc_h_RM%2B56irmCMzg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jun Ohtani) #2

Hi,

You try to use parameter "encoder" instead of "escape_html".

See:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html#_encoder

Regards,

2014/1/1 Guozhu Wei weiguozhu@gmail.com

Dear all

Happy new year!

I have a problem when I use the highlight, I want to highlight a field
'abs' while it contains html, like:

the content of field 'abs':
... The molecule:(L2L3M)n ...

I want to escape the html when highlight and found that the "encoder"
option.

I use this option:

"highlight": {
    "escape_html": "html",
    "pre_tags": ["<strong><span class=\"text-danger\">"],
    "post_tags": ["</span></strong>"],
    "fields": {
        "abs": {
            "fragment_size": 150,
            "number_of_fragments": 1,
            "no_match_size": 150
        }
    }
},

but nothing changed, the html tags like '' still returned untouched.

Any hints of what could be wrong?

Thanks!

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CANnJ_2ObfTrUa9fvb2hkB0wNhSaPw5u9fSc_h_RM%2B56irmCMzg%40mail.gmail.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPW8A5yoqwNRRuAxBOzH_DpFXzSYzA%2Bp3F4HGM%3D4aSWvVA8tZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3