Beckshome.com: Thomas Beck's Blog

Musings about technology and things tangentially related

Lucene + Blazor, Part 5: Highlighting

In this final installment of my Blazor + Lucene.Net series, we’ll be adding highlights for the search terms found in the header and body text of each of our results. The implementation of highlighting makes use of the Lucene.Net.Highlighter library, plugging this library into a simple method that can be used as a filter for search results to highlight key terms.

The code and code narrative below reflects the changes that have been made on top of the first 4 posts. All source code is available online for this highlighting post.


Lucene + Blazor, Part 4: Faceting

In this fourth installment of my Blazor + Lucene.Net series, we’ll make the most significant updates to the classes, search function and UI to date. Facets enrich the query responses, enabling users to further tune the search results along specific, pre-defined vectors. The implementation of facets uses the Lucene.Net.Facet library to implement an additional faceted index over two attributes – Scholars and Universities – which are applied on top of the WaffleText class and data.


Lucene + Blazor, Part 3: Auto Complete

In this third installment of my Blazor + Lucene.Net series, I’ll start tackling some advanced Lucene functionality, namely auto-complete. For advanced Lucene work, the most important lessons is don’t roll your own functionality. If you go to the docs for the Lucene.Net API, you’ll see that a ton of additional functionality is built into Lucene via modules. Modules exist for faceting, highlighting, spatial search and autosuggest, amongst others. Lots of the examples and StackOverflow answers are roll-your-own solutions – don’t do it!!


Lucene + Blazor, Part 2: Results Paging

In the first installment of this series, we looked at returning results from a limited pool of items in a Lucene full text index. In this second installment, we significantly increase the number of generated items (3,000, by default) and add a numbered paging system, as used by the main commercial search engines and search sites.

The code and code narrative below reflects the changes that have been made since the first post. All source code is available online for this results paging post.


Lucene + Blazor, Part 1: Basic Search

Lucene.NET is a C# port of the Java Lucene search engine library. Lucene.NET provides robust search and index capabilities enhanced by a wide array of support packages (e.g. auto-suggest, faceting) that enable the creation of robust search facilities within .NET applications.

While useful and recent tutorials exist on using Lucene.NET in a command line context, there is a dearth of tutorials on using Lucene.NET in a web context, especially with the current Blazor framework. This tutorial fills that gap, with this existing article being the first in a series that will illustrate the buildout of a Blazor-based search site.