Full Text Search - Get Fragments with node js SDK

Hi all,
i use the nodejs sdk and FullTextSearch.
If i testing the request in PostMan with this body:
> {

  "explain": false,
  "fields": [
    "*"
  ],
  "highlight": {},
  "query": {
    "wildcard": "*word"
  }
}

In the response, for any hit, i have this elements:
index
id
score
locations
fragments
sort
fileds

But if i testing the request with the node js sdk i have this elements:
index
id
score
locations
sort
fileds

How can i have the fragments element?
The my request in i node js:

var query = SearchQuery.new(config.couchbase.fulltextsearch, SearchQuery.wildcard('word’));
query.fields("
");
query.limit(limit);
query.skip(offset);
query.explain(false);
query.highlight(SearchQuery.HighlightStyle.ANSI);

Thank
J

Hey @jempis02,

Would you be able to log the generated query before it is dispatched? It should give you some insight into the generated query being sent to the server such that you can identify what is different.

Cheers, Brett

Hi @brett19,
thank you for the response.
sure,
in attachment there are the Chrome ‘developer Tools’ screenshot,
the ‘query_json_before.png’ is the print query before to send the request.
the ‘query_json_after.png’ is the print response, there is only the hits.

You can see that in the response there is not a Highlight, but only locations.

But, i have found a workaround for return the highlight parameter, it is not use the query.highlight() method, but i add the variable manually so ‘query.data.highlight = {};’ (to replicate the Postman query)

I still want to try to use the sdk totally, without the workaround.

Any Idea to resolve the problem??

query_json_before