GithubHelp home page GithubHelp logo

Comments (1)

jibedoubleve avatar jibedoubleve commented on June 3, 2024

Actions

  • Add logs in OnExecuteAliasAsyn
  • Add logs in OnSearchAlias
  • Pipe execution when search in pending

Analysis & notes

Probably the problem is in MainViewModel

I should investigate in this code. I have to try to wait the search is over before executing the alias.

private async Task<SearchContext> OnExecuteAliasAsync(ExecutionContext context)
{
context ??= new ExecutionContext();
var cmd = _cmdlineManager.BuildFromText(context.Query);
if (cmd.Parameters.IsNullOrWhiteSpace() && CurrentAlias is ExecutableQueryResult e)
{
cmd = _cmdlineManager.CloneWithNewParameters(e.Parameters, cmd);
}
IEnumerable<QueryResult> results = new List<QueryResult>();
var scope = new Scope<bool>(x => IsSearchActivated = x, false, true);
using (scope.Open())
{
if (CurrentAlias is null)
{
_log.Warning("Current QueryResult is null");
results = DisplayQueryResult.SingleFromResult($"This alias does not exist");
KeepAlive = true;
}
else if (CurrentAlias is IExecutable exec)
{
_log.Trace($"Found {results.Count()} element(s)");
Query = CurrentAlias is IQueryText t ? t.ToQuery() : CurrentAlias.ToQuery();
if (exec is IExecutableWithPrivilege exp)
{
exp.IsPrivilegeOverriden = context.RunAsAdmin;
}
results = await exec.ExecuteAsync(cmd);
KeepAlive = results.Any();
}
else
{
_log.Info($"Alias '{CurrentAlias.Name}', is not executable. Add as a query");
KeepAlive = true;
results = Results;
}
}
return new() { Results = results };
}
private SearchContext OnSearchAlias(string criterion)
{
if (criterion.IsNullOrWhiteSpace()) { return new(); }
else
{
var query = _cmdlineManager.BuildFromText(criterion);
var results = _searchService.Search(query);
return new()
{
Results = results,
CurrentAliasSuggestion = results.Any() && results.ElementAt(0).IsResult
? results.ElementAt(0)?.Name ?? ""
: "",
};
}
}

from lanceur-bis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.