#4303: add search function.

This commit is contained in:
Ben
2024-06-03 21:19:42 +08:00
parent d75e3acdf3
commit 9d85ca07f4
50 changed files with 2478 additions and 4 deletions

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Oqtane.Models;
namespace Oqtane.Interfaces
{
public interface IModuleSearch
{
public IList<SearchDocument> GetSearchDocuments(Module module, DateTime startTime);
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Oqtane.Models;
namespace Oqtane.Services
{
public interface ISearchIndexManager
{
int Priority { get; }
string Name { get; }
bool IsIndexEnabled(int siteId);
int IndexDocuments(int siteId, DateTime? startTime, Action<IList<SearchDocument>> processSearchDocuments, Action<string> handleError);
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Oqtane.Models;
namespace Oqtane.Services
{
public interface ISearchProvider
{
string Name { get; }
void SaveDocument(SearchDocument document, bool autoCommit = false);
void DeleteDocument(string id);
Task<SearchResults> SearchAsync(SearchQuery searchQuery, Func<SearchDocument, SearchQuery, bool> validateFunc);
bool Optimize();
void Commit();
void ResetIndex();
}
}

View File

@ -0,0 +1,14 @@
using System;
using Oqtane.Models;
namespace Oqtane.Services
{
public interface ISearchResultManager
{
string Name { get; }
bool Visible(SearchDocument searchResult, SearchQuery searchQuery);
string GetUrl(SearchResult searchResult, SearchQuery searchQuery);
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oqtane.Models;
namespace Oqtane.Services
{
public interface ISearchService
{
void IndexContent(int siteId, DateTime? startTime, Action<string> logNote, Action<string> handleError);
Task<SearchResults> SearchAsync(SearchQuery searchQuery);
}
}