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

Multiple word searches have missing results #13

Closed
sidharthramesh opened this issue Apr 19, 2021 · 7 comments
Closed

Multiple word searches have missing results #13

sidharthramesh opened this issue Apr 19, 2021 · 7 comments

Comments

@sidharthramesh
Copy link
Contributor

Search for "Abdominal Pain":

http://localhost:8080/v1/snomed/search?s=abdominal - Returns a lot of results
http://localhost:8080/v1/snomed/search?s=abdominal+p - No results
http://localhost:8080/v1/snomed/search?s=abdominal+pa - No results
http://localhost:8080/v1/snomed/search?s=abdominal+pai - Returns a lot of results

Hermes always returns 0 results / 404 error when the second word has less than 3 characters.

@wardle
Copy link
Owner

wardle commented Apr 19, 2021

This is working as designed.... but the question is... is it the right design....

So there are some autocompletion things that use the whole phrase - as you are doing... but there are others for speedy data entry like 'comm acq pne' that I want to be able to type and autocomplete. So I limit search to minimise too much thrashing to autocomplete a token for three or more. So for your example, expert users are more likely to type abd pai and get what they want - in my clinic I'm never going to type out the word abdominal!

So the question is... am I wrong? Should we be autocompleting on phrase or token, and at what threshold?

One option would be to remove the restriction if there is more than one token. That would mean 'abd p' will work, but I should like to run some tests to see how Lucene manages with a single char prefix. Another option would be to use a different approach for phrase completion, but then you have to type the whole of the first word... which I promise you don't want to force users to do!

The relevant code is here. Each token is combined logically, rather than using Lucene MultiPhraseQuery or similar. I believe MultiPhraseQuery would autocomplete 'abdominal p' but not 'abd pai'. Could add an option to permit a single char prefix search iff the total character count is above two...

@wardle
Copy link
Owner

wardle commented Apr 19, 2021

Also remember that in real usage, you'd always have a constraint on there. Entering a problem list or list of diagnosis for example you'd limit and it's very likely your user would have started typing and selected abdominal pain before typing any more than abdom.

@sidharthramesh
Copy link
Contributor Author

I am limiting the searches to Events and Clinical Findings. And most of the people using my autocomplete will not have any sort of training, so I need to make it as intuitive as possible.

Typing 'adb' does bring up abdominal pain, however, it's the fourth option.

image

The natural tendency is for them to type 'abd p' or 'abdominal p' (for users with no understanding of the autocomplete) until 'Abdominal pain' is the first result.

image

However, when no results are returned they are signalled into thinking that there are no matches for 'abd p' so they infer there won't be any matches for 'abd pai' either, and stop typing! They never get to 'abd pai'.

One fix I could do would be to check if the words other than the first word are less than 3 characters in length and encourage them to keep typing. But I think it's bad UX. Better feedback would be for them to see the results they saw earlier filtering out as they type.

Even when someone is searching for "Community acquired pneumonia" they search for 'com ac' or 'com acq p' before reaching the full 'com acq pne' . When there are no results in the middle, it gives them a scare and they think no terms will match their search.

And this only happens when there are two words. The search still works when they search for single characters.

image

So there is no way that the user will be able to deduce that more than 3 characters are needed for the non-second word without training and instruction.

Removing the 3 character limit from Lucene would be a good start. You can see if it messes up the other searches, and if it doesn't that would be a welcome addition.

@wardle
Copy link
Owner

wardle commented Apr 20, 2021

There are UI examples in which search only begins once you've typed a minimum number of characters. But google now manages with only a single letter. I've done some testing and it looks fine to remove the check on the prefix search - ie allow prefix search for any length of term. It will need careful use of max-hits - and of course the ECL implementation uses this - but let me know how you get on.

Fixed in 2cfabd5 see new release 0.6.2.

@wardle wardle closed this as completed Apr 20, 2021
@sidharthramesh
Copy link
Contributor Author

Thank you! I will test it today and let you know.

@sidharthramesh
Copy link
Contributor Author

Works as expected 🎉🎉
A much improved search experience in my opinion!

@wardle
Copy link
Owner

wardle commented Apr 21, 2021

Glad it worked. It seemed better in my testing as well so thank you for suggesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants