DEV Community

Implementing Search in Blazor WebAssembly With Lucene.NET

Aaron Powell on November 28, 2019

One of the main reasons I blog is to write stuff down that I have learnt so that in the future I can come back to it rather than having to keep it ...
Collapse
 
edcharbeneau profile image
Ed Charbeneau #Blazor #StateHasChanged

Excellent article. I have used Lucene with Umbraco as well, it's quite cool to see it running in Blazor.

One quick point of clarification though. In your conclusion you write:

"I have to admit that when I started trying to build this I didn’t expect it to work. It felt like a rather crazy idea to use what is quite a complex library and compile it to WebAssembly, only to have it “just work”."

While I understand what you're saying here, I think it's worth pointing out to readers that you're not actually compiling Lucene to WebAssembly (Unless I'm mistaken). Instead, Lucene is running on a WebAssembly port of the .NET runtime. I only say this because when new developers come to Blazor they often believe their application code (c#/dlls) is compiled to .wasm when in fact it's just standard .NET libs.

Collapse
 
aaronpowell profile image
Aaron Powell .NET

You're correct, the Mono runtime is the thing that's compiled to WASM bytecode and then bootstraps a CLR just the same as any other CLR runtime. So no, your code isn't compiled to WASM, only Mono.

Collapse
 
suchiman profile image
Robin Sue

The filesystem is actually emulated by emscripten which mono uses, so as far as mono is concerned, it's using an regular unix filesystem.

Collapse
 
aaronpowell profile image
Aaron Powell .NET

Ah, it's emscripten that provides that. I was aware it was a unix file system (I'd done some digging originally and found that out (it's fun when do get it to tell you what OS it is)