Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • coscine/backend/apis/search
1 result
Show changes
Commits on Source (5)
......@@ -15,7 +15,7 @@ namespace Coscine.Api.Search.Controllers
/// Controller for the search.
/// </summary>
[Authorize]
public class SearchController : Controller
public class SemanticSearchController : Controller
{
private readonly IConfiguration _configuration;
private readonly Authenticator _authenticator;
......@@ -29,7 +29,7 @@ namespace Coscine.Api.Search.Controllers
/// <summary>
/// Default constructor.
/// </summary>
public SearchController()
public SemanticSearchController()
{
_configuration = Program.Configuration;
_authenticator = new Authenticator(this, Program.Configuration);
......
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
......@@ -9,21 +10,25 @@ namespace Coscine.Api.Search.Models
[JsonProperty("graphName")]
public Uri GraphName { get; set; }
[JsonProperty("score")]
public double Score { get; set; }
[JsonProperty("project")]
public Uri Project { get; set; }
public SearchResult(string key, double value)
[JsonProperty("source")]
public JObject Source { get; set; }
public SearchResult(string key, string projectValue, JObject value)
{
GraphName = new Uri(key);
Score = value;
Project = new Uri(projectValue);
Source = value;
}
public static IEnumerable<SearchResult> ParseResultsToList(IDictionary<string, double> results)
public static IEnumerable<SearchResult> ParseResultsToList(IDictionary<string, JObject> results)
{
var output = new List<SearchResult>();
foreach (var entry in results)
{
var searchResult = new SearchResult(entry.Key, entry.Value);
var searchResult = new SearchResult(entry.Key, (string)entry.Value["belongsToProject"], entry.Value);
output.Add(searchResult);
}
return output;
......
......@@ -5,7 +5,7 @@
<AssemblyName>Coscine.Api.Search</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFramework>net5.0</TargetFramework>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
</PropertyGroup>
<PropertyGroup>
<Authors>RWTH Aachen University</Authors>
......