NCIOCPL / sitewide-search-api

0 stars 4 forks source link

Autosuggest ignores size parameter #50

Closed bkline closed 2 years ago

bkline commented 3 years ago

Issue description

The Autosuggest feature documents the use of the size parameter to impose a ceiling on the number of terms to be returned to the caller. However, the code always returns ten terms, or all matching terms, whichever is fewer.

ESTIMATE 1

Steps to reproduce the issue

  1. curl 'https://sitewidesearchapi.cancer.gov/sitewidesearch/v1/Autosuggest/cgov/en/liver?size=5'
  2. curl 'https://sitewidesearchapi.cancer.gov/sitewidesearch/v1/Autosuggest/cgov/en/liver?size=10'
  3. curl 'https://sitewidesearchapi.cancer.gov/sitewidesearch/v1/Autosuggest/cgov/en/liver?size=15'

What's the expected result?

What's the actual result?

Additional details / screenshot

image

Patch

index 30c5c3b..2b17a65 100644
--- a/src/NCI.OCPL.Api.SiteWideSearch/Controllers/AutosuggestController.cs
+++ b/src/NCI.OCPL.Api.SiteWideSearch/Controllers/AutosuggestController.cs
@@ -96,7 +96,7 @@ namespace NCI.OCPL.Api.SiteWideSearch.Controllers
                 .File(templateName)
                 .Params(pd => pd
                     .Add("searchstring", term)
-                    .Add("my_size", 10)
+                    .Add("my_size", size)
                 )
             );

Notes

Be sure to add integration tests to verify the correct behavior when the bug has been fixed.

jfrank-nih commented 2 years ago

@bkline I think this can be closed. At least, it works for me on the development branch currently. I'm updating the tests and noticed a comment in there to this ticket.

bkline commented 2 years ago

I see the comment on #42 (another of the bugs I reported) but not this one. Still, it's fixed (perhaps inadvertently). Closing.

jfrank-nih commented 2 years ago

Great. And I've got a test covering it that I'll put in a PR for @blairlearn this week.