Skip to content

搜索组件若是以 “*”开头作为搜索内容站点就会报500错误 #6339

Open

Description

系统信息

使用的哪种方式运行?

Docker

发生了什么?

使用发现搜索内容如果以*开头就会报错

相关日志输出

2024-07-17T11:02:30.246+08:00 ERROR 7 --- [ndedElastic-183] a.w.r.e.AbstractErrorWebExceptionHandler : [d51142c9-8942]  500 Server Error for HTTP GET "/search?keyword=*"

java.lang.RuntimeException: LEADING_WILDCARD_NOT_ALLOWED: Leading wildcard is not allowed: title:*
	at run.halo.app.search.lucene.LuceneSearchEngine.search(LuceneSearchEngine.java:219) ~[classes/:2.17.2]
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	*__checkpoint ⇢ Handler run.halo.search.widget.SearchView$$Lambda/0x00000000440f58b0@5b74af57 [DispatcherHandler]
	*__checkpoint ⇢ run.halo.app.security.InitializeRedirectionWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.app.security.LoginRequiredForAccessWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.app.security.device.DeviceSessionFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.app.sms.security.SmsLoginAuthenticator [DefaultWebFilterChain]
	*__checkpoint ⇢ AuthorizationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ ExceptionTranslationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ LogoutWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ ServerRequestCacheWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ LogoutPageGeneratingWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ AnonymousAuthenticationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ SecurityWebFilterChainProxy [DefaultWebFilterChain]
	*__checkpoint ⇢ TotpAuthenticationFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ AuthenticationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ SecurityWebFilterChainProxy [DefaultWebFilterChain]
	*__checkpoint ⇢ RememberMeAuthenticationFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ SecurityWebFilterChainProxy [DefaultWebFilterChain]
	*__checkpoint ⇢ AuthenticationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ AuthenticationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ ReactorContextWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ CsrfWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ CorsWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ HttpHeaderWriterWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.cache.page.PageCacheWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.seo.tools.AdvancedRedirectWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.comment.widget.captcha.CommentCaptchaFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.app.sms.security.SmsLoginAuthenticator [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.social.login.security.SocialAuthenticatorFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.oauth.Oauth2Authenticator [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.seo.tools.CrawlRecordFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.social.login.security.SocialAuthorizationRequestRedirectWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.oauth.Oauth2AuthorizationRequestRedirectWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ cc.ryanc.staticpages.endpoint.RewriteOnNotFoundFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ run.halo.app.webfilter.AdditionalWebFilterChainProxy [DefaultWebFilterChain]
	*__checkpoint ⇢ HTTP GET "/search?keyword=*" [ExceptionHandlingWebHandler]
Original Stack Trace:
		at run.halo.app.search.lucene.LuceneSearchEngine.search(LuceneSearchEngine.java:219) ~[classes/:2.17.2]
		at run.halo.app.search.SearchServiceImpl.lambda$search$0(SearchServiceImpl.java:33) ~[classes/:2.17.2]
		at reactor.core.publisher.MonoSupplier.call(MonoSupplier.java:67) ~[reactor-core-3.6.7.jar:3.6.7]
		at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:228) ~[reactor-core-3.6.7.jar:3.6.7]
		at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) ~[reactor-core-3.6.7.jar:3.6.7]
		at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) ~[reactor-core-3.6.7.jar:3.6.7]
		at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
		at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
		at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
Caused by: org.apache.lucene.queryparser.flexible.core.QueryNodeException: Leading wildcard is not allowed: title:*
	at org.apache.lucene.queryparser.flexible.standard.processors.AllowLeadingWildcardProcessor.postProcessNode(AllowLeadingWildcardProcessor.java:77) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:89) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl.processChildren(QueryNodeProcessorImpl.java:112) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:87) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl.processChildren(QueryNodeProcessorImpl.java:112) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:87) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl.process(QueryNodeProcessorImpl.java:81) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.standard.processors.AllowLeadingWildcardProcessor.process(AllowLeadingWildcardProcessor.java:53) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorPipeline.process(QueryNodeProcessorPipeline.java:78) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.core.QueryParserHelper.parse(QueryParserHelper.java:219) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at org.apache.lucene.queryparser.flexible.standard.StandardQueryParser.parse(StandardQueryParser.java:279) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
	at run.halo.app.search.lucene.LuceneSearchEngine.search(LuceneSearchEngine.java:151) ~[classes/:2.17.2]
	at run.halo.app.search.SearchServiceImpl.lambda$search$0(SearchServiceImpl.java:33) ~[classes/:2.17.2]
	at reactor.core.publisher.MonoSupplier.call(MonoSupplier.java:67) ~[reactor-core-3.6.7.jar:3.6.7]
	at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:228) ~[reactor-core-3.6.7.jar:3.6.7]
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) ~[reactor-core-3.6.7.jar:3.6.7]
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) ~[reactor-core-3.6.7.jar:3.6.7]
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
	at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]

附加信息

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues or PRs related to the Halo Corekind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions