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

Problems with ElmTextSearch.remove and later calls to ElmTextSearch.search #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mthadley
Copy link

Hey there! For starters, thanks for making this awesome library!

I was having some problems today with ElmTextSearch.remove. After calling it to remove a document from an index, I noticed that later search results seemed to come up empty. Perhaps I have misinterpreted what remove is supposed to do. Either way, I think I was able to reproduce it what I was seeing with a failing test.

For example, try removing the call to remove in the test, and you'll see that the test will start passing:

removeDoesNotBreakSearchResults : Test
removeDoesNotBreakSearchResults =
    test "Remove does not break searching" <|
        \() ->
            getIndexDoc1Doc2 ()
                -- Commenting these lines causes the test to pass
                -- |> Index.remove doc2_
                -- |> TestUtils.getResultIgnoreError
                |> Index.search "Sally"
                |> TestUtils.getResultIgnoreError
                |> Tuple.second
                |> List.map Tuple.first
                |> Expect.equal [doc1_.cid]

I'm not familiar with the internals of the library, so I didn't attempt a fix. However, even before that, does this seem like an actual bug?

@rluiten
Copy link
Owner

rluiten commented Jun 15, 2021

On the surface it looks to me like a bug.
I hope to allocate some time to this in the next week or so.
Thank you for reporting it with a unit test.

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

Successfully merging this pull request may close these issues.

2 participants