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

how to use #2

Closed
A-Programmer opened this issue Jan 12, 2018 · 1 comment
Closed

how to use #2

A-Programmer opened this issue Jan 12, 2018 · 1 comment

Comments

@A-Programmer
Copy link

A-Programmer commented Jan 12, 2018

Hello.
How can I use this in asp.net core2?
I mea does it available as a nuget pakage?

@omerfarukz
Copy link
Owner

Hi,
Just published a new package named Autocomplete.Clients.

Following code is for indexing:

using(var header = new FileStream("header.bin", FileMode.CreateNew)) {
    using(var index = new FileStream("index.bin", FileMode.CreateNew)) {
        var builder = new IndexBuilder(header, index);

        builder.Add("foo");
        builder.Add("bar");
        builder.Build();
    }
}

and following for search:

// searcher declared just for example
IndexSearcher searcher = new InMemoryIndexSearcher("header.bin", "index.bin");

string keyword = "f"; // read given keyword
var searchResult = searcher.Search(keyword, 10, true);

if(searchResult.Items != null)
{
    foreach(var item in searchResult.Items)
    {
        System.Console.WriteLine(item);
    }
}

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