Quick Start

Please follow these simple steps to quickly setup SearchUnit in a web application. If you have any questions at all please contact us at support@keyoti.com

ASP.NET 5+

Step 1 (Setup)
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
Step 8
Step 9
Step 10 (Search)

Step 1. Load/Create a project and add a page.



Next

Step 2. Create a new folder to store the index files;

  1. Right click on wwwroot under the project and choose Add -> New Folder
  2. Create a new folder called 'Keyoti_Search_Index'



Next








Step 3. Open the Index Manager Tool from the Start Menu and enter the path to your index directory.

The Index Manager Tool can be found under the Start Menu;

Start Menu -> All Programs -> SearchUnit -> Index Manager Tool




Next

Step 4. Select 'Import New Source', enter the start URL & click 'Import'.




If an error reports the page cannot be read, please check the URL or consult the user guide for help.

Once the import is complete close the Import window, select 'Optimize' and click 'Start Optimize'.




Next

Step 5. Copy the SearchUnit scripts folder to your project;

  1. Open the SearchUnit install folder (via Start Menu or File Explorer).
  2. Copy the 'Keyoti_SearchEngine_Web_Common' folder.
  3. Paste to your application's Solution Explorer, in wwwroot.




  4. Next

Step 6. Add the SearchUnit JS and CSS tags to the head of your page.

To automatically add the tags, drag SearchUnit.js and SearchUnit.css from the Solution Explorer on to the page source. Alternatively copy and paste the tags as below to the head of your page.

<script src ="Keyoti_SearchEngine_Web_Common/SearchUnit.js"></script>
<link href ="Keyoti_SearchEngine_Web_Common/SearchUnit.css" rel ="stylesheet" />

Add this Javascript to your page

<script type ="text/javascript">keyotiSearch.setServiceType('core');</script>


Next

Step 7. Add the SearchUnit divs to your page.

<div id ="sew_searchBoxControl"></div>
<div id ="sew_searchResultControl"></div>

sew_searchBoxControl is the search text box and button.

sew_searchResultControl is the search result control.



Next

Step 8. Register the SearchUnit WebAPI controller.

.NET 6+

In Program.cs add controllers to the 'builder', eg. the bold lines
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers().AddApplicationPart(System.Reflection.Assembly.Load(new System.Reflection.AssemblyName("Keyoti5.SearchEngine.Web"))).AddControllersAsServices();

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();
...
                                              
app.MapControllers();
                                              
app.Run();

.NET 5

Add the bold code to your Startup.ConfigureServices

public void ConfigureServices(IServiceCollection services)
{
    services.AddRazorPages();
    services.AddControllers().AddApplicationPart(System.Reflection.Assembly.Load(new System.Reflection.AssemblyName("Keyoti5.SearchEngine.Web")));
}

Ensure the controllers are mapped (otherwise AJAX calls from the client will fail, with a 404), eg. add the bold line in Configure

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseExceptionHandler("/Error");
        app.UseHsts();
    }

    app.UseHttpsRedirection();
    app.UseStaticFiles();

    app.UseRouting();

    app.UseAuthorization();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapRazorPages();
        endpoints.MapControllers();
    });
}


Next

Step 9. Add needed references and nuget packages


Add references from C:\Program Files (x86)\Keyoti Inc\SearchUnit v8\NETCLR_v5_BIN\ to
  • Keyoti5.SearchEngine.Core.DLL
  • Keyoti5.SearchEngine.License.DLL
  • Keyoti5.SearchEngine.Suggestions.dll
  • Keyoti5.SearchEngine.Web.DLL
  • Keyoti5.Text.LemmaGenerator.dll
  • Keyoti5.Text.MSOffice.dll
  • Keyoti.SearchEngine.SuggestionsDictionary.dll

If not already added you will need to add these nuget packages
  • System.Runtime.Caching
  • Newtonsoft.Json
to your project.

Next

Step 10. Run the web application (hit F5) and try a search!




Here a search was done for 'chicken' in the SearchUnit demo recipes project.

Go further!

Now you're ready to explore more features in SearchUnit, please take a look at the 'Features' page in the help for more information on all that SearchUnit can do.