我正在寻找一种在Lucene中进行查询自动完成/建议的方法.我用Google搜索了一下并玩了一下,但我见过的所有例子似乎都是在Solr中设置过滤器.我们不使用Solr,并且不打算在不久的将来转向使用Solr,而Solr显然只是在Lucene周围,所以我想必须有办法做到这一点!
我已经研究过使用EdgeNGramFilter了,我意识到我必须在索引字段上运行过滤器并获取令牌,然后将它们与输入的Query进行比较......我只是在努力建立连接这两个代码,所以非常感谢帮助!
要清楚我正在寻找什么(我意识到我不是太清楚,对不起) - 我正在寻找一个解决方案,当搜索一个术语时,它会返回一个建议查询列表.当在搜索字段中键入"inter"时,它将返回一个建议查询列表,例如"internet","international"等.
我们每隔7小时对Lucene索引和增量索引每7天运行一次完整的重新索引(即从头开始创建索引).我们的索引有大约700,000个文档,完整索引大约需要17个小时(这不是问题).
当我们进行增量索引时,我们只会对过去两小时内已更改的内容进行索引,因此所需时间会少得多 - 大约半小时.但是,我们注意到很多时候(可能是10分钟)花在运行IndexWriter.optimize()方法上.
该LuceneFAQ提到:
IndexWriter类支持optimize()方法,该方法压缩索引数据库并加快查询速度.在执行文档集的完整索引或索引的增量更新之后,您可能希望使用此方法.如果增量更新经常添加文档,则只需要偶尔执行一次优化,以避免额外的优化开销.
......但这似乎没有给出"经常"含义的任何定义.优化是CPU密集型和非常密集的IO,所以如果我们能够摆脱它,我们宁愿不这样做.在未优化的索引上运行查询的效果是多少(特别是在完全重新索引之后的查询性能方面与20个增量索引之后相比,例如50,000个文档已经更改)?我们应该在每个增量索引之后进行优化还是性能损失不值得?
这是我第一次使用 StackOverflow,希望能在这里得到一些回复。我正在使用 Windows Active Directory 2008 使用 spring-ldap api 来存储来自 java 的新用户
我的问题是我无法添加带有密码的用户。我在某处读到在 AD 中设置密码,我应该使用该unicodePwd
属性。来源:
http ://geekswithblogs.net/lance/archive/2005/08/19/LdapAuthenticationASP.aspx
public void insertContact(ContactDTO contactDTO) {
try{
Attributes personAttributes = new BasicAttributes();
BasicAttribute personBasicAttribute = new BasicAttribute("objectclass");
personBasicAttribute.add("person");
personBasicAttribute.add("user");
personAttributes.put(personBasicAttribute);
personAttributes.put("givenName", contactDTO.getCommonName());
personAttributes.put("cn", contactDTO.getCommonName());
personAttributes.put("sn", contactDTO.getLastName());
personAttributes.put("description", contactDTO.getDescription());
personAttributes.put("unicodePwd",
this.createUnicodePassword(contactDTO.getPassword()) );
personAttributes.put("userPrincipalName", contactDTO.getUserLoginName());
personAttributes.put("sAMAccountName", contactDTO.getsAMAccountName());
personAttributes.put("displayname", contactDTO.getDisplayname());
// personAttributes.put( "pwdLastSet", "0" );
// personAttributes.put( "LockOutTime", "0" );
personAttributes.put("userAccountControl", "544");
BasicAttribute roomAttribute = new BasicAttribute("roomNumber");
for(String r : contactDTO.getRoomNumber())
{
roomAttribute.add(r);
}
personAttributes.put(roomAttribute); …
Run Code Online (Sandbox Code Playgroud)