manticoresearch icon indicating copy to clipboard operation
manticoresearch copied to clipboard

The html_strip_mode option in highlight with http request returns an Unknown option: strip_mode error

Open washanhanzi opened this issue 2 years ago • 2 comments

I have an index with html_strip set to 1, when I set html_strip_mode to retain or none in http request, manticore response with an error:

{
	"error": "index regulations: parse error: Unknown option: strip_mode"
}

The option index works fine.

reproduce:

  1. create table t(f text) html_strip='1';insert into t(f) values('<p>你好 manticore 哈哈哈哈 </p>')
  2. the worked case:
  • request
{
	"index": "t",
	"query": {
		"query_string": "你好"
	},
	"highlight": {
		"limit": 0,
		"html_strip_mode": "index"
	}
}
  • response:
{
	"took": 0,
	"timed_out": false,
	"hits": {
		"total": 1,
		"total_relation": "eq",
		"hits": [
			{
				"_id": "3460511486852464642",
				"_score": 1,
				"_source": {
					"f": "<p>你好 manticore 哈哈哈哈 </p>"
				},
				"highlight": {
					"f": [
						" 你好 manticore 哈哈哈哈 "
					]
				}
			}
		]
	}
}
  1. the error case:
  • request:
{
	"index": "t",
	"query": {
		"query_string": "你好"
	},
	"highlight": {
		"limit": 0,
		"html_strip_mode": "none"
	}
}
  • response:
{
	"error": "index t: parse error: Unknown option: strip_mode"
}

washanhanzi avatar Aug 18 '22 05:08 washanhanzi

Another MRE showing the same error with option encoder:

➜  ~ mysql -P9306 -h0 -e "drop table if exists t; create table t(f text) html_strip='1'; insert into t(f) values('<p>abc</p>');"
➜  ~ curl -sX POST http://localhost:9308/search  -d '
{
  "index": "t",
  "query_string": "abc",
  "highlight":
  {
    "fields": [ "f" ],
    "encoder": "html"
  }
}' |jq .
{
  "error": "index t: parse error: Unknown option: strip_mode"
}

sanikolaev avatar Aug 18 '22 05:08 sanikolaev

Noticed this behavior as well with the python client. Additionally, in certain documents, encoder set to default, does not result in any highlights. This may be related to special character issue mentioned in #863

regstuff avatar Aug 22 '22 10:08 regstuff