bleroy / lunr-core

A port of LUNR.js to .NET Core
MIT License
565 stars 24 forks source link

Loading from JSON yields different results vs building new index #12

Closed surgicalcoder closed 4 years ago

surgicalcoder commented 4 years ago

It appears that when running a search against a built index, vs running against one that's loaded from JSON, I get different results,

I built a simple example - https://gist.github.com/surgicalcoder/802fed94e01098640656ec97f9f0b792 , and the output I get is:

Built Index Search result count = 1 JSON Index Search result count = 0

Another thing I noticed was that builtIndex.TokenSet has 13 Edges, where as jsonIndex.TokenSet has 0 Edges.

I tried changing loading jsonIndex to :

            var jsonIndex = Index.LoadFromJson(JSON, registry:new PipelineFunctionRegistry()
            {
                {"trimmer", new Trimmer().FilterFunction},
                {"stopWordFilter", new EnglishStopWordFilter().FilterFunction}

            });

as the Json index had those 2 missing pipelines, but no change.

Am I missing a function call after loading the index from JSON?