Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] highlights return types are different for different search methods #70

Closed
jn2clark opened this issue Sep 19, 2022 · 5 comments
Closed
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jn2clark
Copy link
Contributor

jn2clark commented Sep 19, 2022

Describe the bug
The results highlights field has a different return type for the different search methods. LEXICAL returns an empty list while TENSOR returns a dict.
accessed viaresults['hits'][0]['_highlights']
To Reproduce
Steps to reproduce the behavior:

  1. Install marqo per readme
import marqo as mq
client = mq.Client()
client.index("my-first-index").add_documents([{'text':'something'}])
client.index("my-first-index").search('something') # _highlights type is a dict
client.index("my-first-index").search('something', search_method='LEXICAL') # _highlights type is a list

Expected behavior
The return types are the same.

Screenshots
image

Desktop (please complete the following information):

  • OS: [e.g. iOS] ubuntu 20.04
@jn2clark jn2clark added bug Something isn't working good first issue Good for newcomers labels Sep 19, 2022
@Pouyanpi
Copy link

Hi @jn2clark ,

I think the issue is the following line

   res_list.append({**just_doc, "_highlights": []})

I think chaning it to

   res_list.append({**just_doc, "_highlights": {})

will resolve the issue.

is it what you are looking for or I've got it wrong?

p.s.

Also, I think it would be better to define a global constant like _EMP_HIGHLIGHT = {}.

@jn2clark
Copy link
Contributor Author

Thanks @Pouyanpi ! That sounds like the solution. Do you want to put your solution into a pull request?

@Pouyanpi
Copy link

@jn2clark , sure I will open a PR asap.

@jn2clark
Copy link
Contributor Author

Sounds good.

@farshidz
Copy link
Collaborator

This is addressed in Marqo v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants