Pjamaica
Pjamaica
CC#
Created by Pjamaica on 3/19/2025 in #help
Lucene.net problem with wildcard search
I have a worker service that writes data into a lucene database. I have tried different analyzers all have the same problem. (the problem is most likely in my search code)
// var analyzer = new KeywordAnalyzer();
// var analyzer = new WhitespaceAnalyzer(luceneVersion);
var analyzer = new SimpleAnalyzer(luceneVersion);
// var analyzer = new StandardAnalyzer(luceneVersion);
// var analyzer = new KeywordAnalyzer();
// var analyzer = new WhitespaceAnalyzer(luceneVersion);
var analyzer = new SimpleAnalyzer(luceneVersion);
// var analyzer = new StandardAnalyzer(luceneVersion);
Client code:
var filenameQuery = new WildcardQuery(new Term(DocProp.Filename, "*" + SearchFor.ToLowerInvariant() ));
filenameQuery.Boost = 2.0f;
var filenameQuery2 = new WildcardQuery(new Term(DocProp.Filename, SearchFor.ToLowerInvariant()+"*" ));
filenameQuery2.Boost = 2.0f;
var filenameQuery3 = new WildcardQuery(new Term(DocProp.Filename,"*"+ SearchFor.ToLowerInvariant()+"*" ));
filenameQuery3.Boost = 2.0f;
var filenameQuery4 = new TermQuery(new Term(DocProp.Filename, SearchFor.ToLowerInvariant() ));
filenameQuery4.Boost = 2.0f;

var filePathQuery = new TermQuery(new Term(DocProp.Path, SearchFor.ToLowerInvariant() ));

var contentQuery = new TermQuery(new Term(DocProp.Content , SearchFor.ToLowerInvariant()));
var query = new BooleanQuery();
query.Add(filenameQuery,Occur.SHOULD);
query.Add(filenameQuery2,Occur.SHOULD);
query.Add(filenameQuery3,Occur.SHOULD);
query.Add(filenameQuery4,Occur.SHOULD);
query.Add(filePathQuery,Occur.SHOULD);
query.Add(contentQuery,Occur.SHOULD);
var filenameQuery = new WildcardQuery(new Term(DocProp.Filename, "*" + SearchFor.ToLowerInvariant() ));
filenameQuery.Boost = 2.0f;
var filenameQuery2 = new WildcardQuery(new Term(DocProp.Filename, SearchFor.ToLowerInvariant()+"*" ));
filenameQuery2.Boost = 2.0f;
var filenameQuery3 = new WildcardQuery(new Term(DocProp.Filename,"*"+ SearchFor.ToLowerInvariant()+"*" ));
filenameQuery3.Boost = 2.0f;
var filenameQuery4 = new TermQuery(new Term(DocProp.Filename, SearchFor.ToLowerInvariant() ));
filenameQuery4.Boost = 2.0f;

var filePathQuery = new TermQuery(new Term(DocProp.Path, SearchFor.ToLowerInvariant() ));

var contentQuery = new TermQuery(new Term(DocProp.Content , SearchFor.ToLowerInvariant()));
var query = new BooleanQuery();
query.Add(filenameQuery,Occur.SHOULD);
query.Add(filenameQuery2,Occur.SHOULD);
query.Add(filenameQuery3,Occur.SHOULD);
query.Add(filenameQuery4,Occur.SHOULD);
query.Add(filePathQuery,Occur.SHOULD);
query.Add(contentQuery,Occur.SHOULD);
An example filename that I search for is "Skype" These searches give the correct result: ky kyp kype These search do not give any result (all starting with the first letter) Sk Sky Skyp Skype When debugging I can see that the variable "SearchFor" is correct and not truncated.
1 replies
CC#
Created by Pjamaica on 11/22/2023 in #help
Reference base in different project/dll
I want to pass "base" to a function in a different dll but I can't seem to find the correct syntax. I have tried with (Application base) but can't access CreateWindow
namespace NameOfApp
{
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new AppShell();
}

protected override Window CreateWindow(IActivationState activationState)
{
//this should be handled by the other DLL
var window = base.CreateWindow(activationState);
//

return DifferentDLL.SetCustomSize(base);
}
}
}
namespace NameOfApp
{
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new AppShell();
}

protected override Window CreateWindow(IActivationState activationState)
{
//this should be handled by the other DLL
var window = base.CreateWindow(activationState);
//

return DifferentDLL.SetCustomSize(base);
}
}
}
1 replies
CC#
Created by Pjamaica on 1/24/2023 in #help
How to change the icon for Android in a Maui/Blazor application?
Net 7.0, latest visual studio preview. I have a simple (beginner) one page Maui/Blazor app that is working fine with the default icon and default splash screen. (both windows and android with emulator and a real device connected with USB cable) I have created a custom icon and changed the project file <MauiIcon Include="Resources\AppIcon\coaster.png" /> This works on windows, but android gives an error: invalid file path '...Debug\net7.0-android\res\appicon\coaster.png'. I have tried to create new folders under android/resources, but I can't get it to compile. The default .svg icon works without a problem. Any hints?
2 replies