I am wondering how I can integrate wagtail with microsoft sql server. The basic search is working fine, but I would like to perform full text search on custom content.
Basic search endpoint (from default wagtail) project
def search(request):
search_query = request.GET.get("query", None)
page = request.GET.get("page", 1)
# Search
if search_query:
search_results = list(Page.objects.live().search(search_query))
else:
search_results = Page.objects.none()
# Pagination
paginator = Paginator(search_results, 10)
try:
search_results = paginator.page(page)
except PageNotAnInteger:
search_results = paginator.page(1)
except EmptyPage:
search_results = paginator.page(paginator.num_pages)
return TemplateResponse(
request,
"search/search.html",
{
"search_query": search_query,
"search_results": search_results,
},
)
After hours of investigation I have come to the conclusion that
https://github.com/wagtail/wagtail/blob/2c6ab32d61c4215607369ff2e3a13d270c467693/wagtail/search/backends/database/fallback.py#L22
We are using the fallback and wagtail will not index our content because of our database driver. Does anyone have any suggestions on how to either customize the search logic to search custom fields, or work arounds for the indexing issue in wagtail?