matchLevel and matchedWords appear to be incorrect

I don’t understand the results, shown below for the search term “shoe” where I have two searchable attributes: “Tags” and “Meaning”.

For the “Tags” field, the hit is occurring on the word “shoestring” so surely this is a partial matchLevel and the matchedWord is “shoestring”

   "Tags" : {
      "value" : "economy, inflation, growth, GDP, rise, increase, revenue, financial, business, trade, industry, commercial, mercantile, fiscal, bugetary, budget, gdp, balance, retail, income, outgoings, tax, tariff, price, value, monetary, profit, loss, success, product, productive, material, commercial, profitable, viable, solvent, insolvent, bankrupt, bankruptcy, fair, cheap, modest, growth, prudent, thrift, lucrative, inexpensive, expensive, goods, chattel, finance, economize, save, cutback, expenditure, frugality, frugal, <em>shoe</em>string, governments, debt, nations, employment, unemployment, welfare, benefits, markets, industrial, wages, gross, net, taxes, competition, exchange, freight, cargo, transport, enviromental, entrepreneur, export, imports, commodity, deficit, haven, managerial, white collar, blue collar, working class, middle class, privatization, nationalization, margins, merger, merchant, assets, vat, index, poverty, rich, slump, interest, self-employment, wealth, creation, restraint, worker, venture, capital, bank, wholesale, wage, social, cost, paye, psbr, policy, mint, loan, listed, company, labour, invoice",
      "matchLevel" : "full",
      "fullyHighlighted" : false,
      "matchedWords" : ["shoe"]
    },
    "Meaning" : {
      "value" : "economy",
      "matchLevel" : "none",
      "matchedWords" : []
    }

Ah - I see that the matchedWords is an array of matched words from the search string, not from the target string. My mistake. I should be looking for ['_highlightResult']['attribute-name']['value'] to get the target match.

But would be nice if the API returned the actual target word that “matched” in addition to the entire attribute string rather than having to rely on regex for the highlight (emphasis) tags in the string.

Hi @goldingp - thanks for posting and glad you were able to figure this out. You are correct, matched words is from the query (related docs).

As for return matched words from the dataset, I’m wondering if @alex or @sylvain has thoughts here?