我为PDF文档实现了一个简单的添加工具.我首先创建所有文档的主文档(SolrInputDocument).它获取了诸如author,filehash,keywords,'content_type = document'等字段.
之后我为每个页面生成一个SolrInputDocument,该对象获得一个像'parentID_p01'的id,该页面作为字段值,'content_type = page'usw.
最后,我使用addChildDocument()将所有页面文档添加到我的主文档中.
现在我的问题是,如何在所有文档的所有页面中搜索给定的单词,例如:
Document1.pdf 'this is my doc1 title' [2 matches]
[Page 14] 'Example phrase for special a <em>word</em> given by....
[Page 55] 'another <em>word</em> for this test
Document2.pdf 'doc2 title' [X matches]
[Page 1] 'given <em>word</em> in this text
[Page 2] '<em>words</em> hit more than fists
[Page 99] 'some <em>words</em> of wisdom
Run Code Online (Sandbox Code Playgroud)
我的第一个想法是用' text:word~ ' 进行简单搜索然后按父文档分组,但我找不到一个好方法:-(
似乎嵌套文档对solr来说有点新,我没有找到SolrJ的简单解决方案.
提前致谢
我正在使用SonarQube来提高代码质量.我遇到了一个与异常处理有关的问题,它说从finally块中删除了throw子句.
} catch(Exception e) {
throw new MyException("request failed : ", e);
} finally {
try {
httpClient.close();
} catch (IOException e) {
throw new MyException("failed to close server conn: ", e);
}
}
Run Code Online (Sandbox Code Playgroud)
根据我的理解,上面的代码看起来不错.如果我在最后删除throw子句并禁止异常,则此方法的调用者将无法知道服务器的状态.我不确定如果没有throw子句我们如何能够实现相同的功能.
我在解密saml令牌时遇到错误.但是,重新启动服务器后,此问题不一致.它工作正常,直到昨晚:(
DEBUG Decrypter:631 - Attempt to decrypt EncryptedKey using credential from KEK KeyInfo resolver failed:
org.opensaml.xml.encryption.DecryptionException: Probable runtime exception on decryption:unknown parameter type.
at org.opensaml.xml.encryption.Decrypter.decryptKey(Decrypter.java:705)
at org.opensaml.xml.encryption.Decrypter.decryptKey(Decrypter.java:628)
at org.opensaml.xml.encryption.Decrypter.decryptUsingResolvedEncryptedKey(Decrypter.java:783)
at org.opensaml.xml.encryption.Decrypter.decryptDataToDOM(Decrypter.java:524)
at org.opensaml.xml.encryption.Decrypter.decryptDataToList(Decrypter.java:442)
at org.opensaml.xml.encryption.Decrypter.decryptData(Decrypter.java:403)
at org.opensaml.saml2.encryption.Decrypter.decryptData(Decrypter.java:141)
at org.opensaml.saml2.encryption.Decrypter.decrypt(Decrypter.java:69)
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:199)
at org.springframework.security.saml.SAMLAuthenticationProvider.authenticate(SAMLAuthenticationProvider.java:82)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
at org.springframework.security.saml.SAMLProcessingFilter.attemptAuthentication(SAMLProcessingFilter.java:84)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:195)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.saml.metadata.MetadataGeneratorFilter.doFilter(MetadataGeneratorFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at …Run Code Online (Sandbox Code Playgroud) 我需要在我们的应用程序中使用Spring SAML来为一个客户启用联合SSO.但是,我们需要使用spring-security为其他客户维护现有的登录流程.
所以我的问题是我们可以为Web应用程序提供两种安全机制,以便将其视为多租户.
我可以在同一个应用程序中实现OAuth和SAML.
提前致谢..
我在我的应用程序中配置了spring-saml和spring安全性.我已经给出了不同的url模式来识别请求.如果我在应用程序URL中追加/休息,那么它将创建具有基本身份验证的spring-security上下文.如果我在应用程序URL中附加/ saml,那么它将填充IDP登录页面并在成功登录后重定向到index.html.
但我再次被重定向到login.html页面而不是index.html.在eclipse调试并在此处放置一些日志之后,我得到了没有可用的身份验证对象.
我已阅读此jira链接并将更新的spring-security版本更新为3.1.4.RELEASE但它没有解决我的问题.
After struggling a lot I find that saml security context is getting cleared by filterChainProxy doFilter method and setting authentication is null and then redirecting to the secured target url which requires authentication which is not present. hence it redirect to login page.
I googled a lot but did not find any way to use saml authentication to pass j_spring_security check.
I have attached my saml-security.xml and spring-security.xml file below …
我们如何使用Solr: 我们正在存储7K文档,其中3k属性附加到solr中的一个文档.每个属性都在solr上编制索引,以便对这些属性进行搜索/排序.我们根据搜索/过滤条件从solr获取数据,其中400+属性附加到一个文档.因此,当我们尝试在solr中使用1个属性搜索某些文本时(通过设置fl ="projectId"),在solr控制台上显示结果几乎不需要1秒,这很好.
但是,如果我们尝试获取相同搜索条件的100+属性(将返回带有4K属性的7K文档中匹配文档(~50)的字符串~100*3*no),则需要约20秒.但我们需要使用匹配文档获取400+属性需要很长时间~90秒,之前由于outOfMemoryError而崩溃,我们通过增加RAM大小和JVM堆大小来解决这个问题.
与Solr的Mysql数据同步: 目前我们使用MySql DB作为主数据库,Solr Server作为辅助数据库.我们曾经每天与Solr服务器同步mysql数据.每当我们更新Mysql DB上的任何属性时,我们也会更新solr服务器.
在应用程序中使用solr结果数据: 应用程序仪表板将包含用户预先配置的列(属性)的文档.用户可以应用搜索/过滤条件在其仪表板上填充所需的结果.因此,我们的应用程序尝试通过访问它来从solr服务器获取具有搜索/过滤条件的数据.
我们已经尝试了很多东西,比如增加堆大小,RAM大小和没有CPU,但没有运气.数据日益增加,这导致了很多问题.它适用于小型项目或小型属性,但每当我们尝试获取更多属性时,它会花费太多时间,有时它会崩溃.
我不确定我们是否正确使用索引?
谁能建议更好/替代方法?提前致谢.
我们面临 SpringSecurity 忽略方法的问题。我们尝试跳过一些 URL(执行器/健康)和资源的身份验证。身份验证是在外部进行的,我们有一个自定义过滤器来提取授权原则。
我们重写配置的方法,如下所示:
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/resources/**", "/actuator/health");
}
protected void configure(HttpSecurity http) throws Exception {
http.addFilter(cutstomFilter).authorizeRequests()
.antMatchers("/add","/update","/upload").hasAuthority("ADMIN").anyRequest().authenticated()
.and().logout().logoutSuccessUrl("/logoutUser").and()
.exceptionHandling().accessDeniedPage("/accessDenied").and().csrf().disable();
}
Run Code Online (Sandbox Code Playgroud)
通过给定的实现,我们的 customFilter 被调用以获取资源和健康 url。由于原则改变,这导致重新验证。
我们尝试添加此代码,但也调用了 customFilter 以获取健康 url。
http.authorizeRequests().antMatchers("/actuator/health").permitAll()
Run Code Online (Sandbox Code Playgroud)
注意:检查了 @Rob Winch 的答案,但不明白如果我们将这些 url 放入忽略列表中,为什么我们需要自定义文件管理器。 /sf/answers/1398972641/
java ×6
spring-saml ×3
saml-2.0 ×2
solr ×2
spring ×2
adfs2.0 ×1
lucene ×1
mysql ×1
oauth-2.0 ×1
performance ×1
solrj ×1
spring-boot ×1