什么时候用Lucene.NET更新索引?异步?

时间:2021-07-29 03:04:28

Is it generally fast enough to make simple updates synchronously? For instance with a ASP.NET web app, if I change the person's name... will I have any issues just updating the index synchronously as part of the "Save" mechanism?

它是否足够快以同步方式进行简单的更新?例如使用ASP。NET网络应用,如果我改了人的名字……作为“保存”机制的一部分,是否有同步更新索引的问题?

OR is the only safe way to have some other asynchronous process to make the index updates?

或者,让其他异步进程进行索引更新是唯一安全的方法吗?

2 个解决方案

#1


2  

We do updates both synchronous and asynchronously depending on the kind of action the user is doing. We have implemented the synchronous indexing in a way where we use the asynchronous code and just waits for some time for its completion. We only wait for 2 seconds which means that if it takes longer then the user will not see the update but normally the user will.

我们根据用户正在执行的操作类型进行同步和异步更新。我们在使用异步代码的方式中实现了同步索引,并等待一段时间来完成它。我们只需要等待2秒,这意味着如果它需要更长的时间,用户就不会看到更新,但通常用户会看到更新。

We configured logging in a way so we would get notified whenever the "synchronous" indexing took longer than we waited to get an idea of how often it would happen. We hardly ever get over the 2 second limit.

我们以某种方式配置了日志记录,以便当“同步”索引花费的时间比我们等待的时间长时,我们会得到通知,以了解它发生的频率。我们几乎没有超过2秒的极限。

#2


0  

If you are using full text session, then you don't need to update indexs explicitly. Full text session take care of indexing updated entity.

如果使用全文会话,则不需要显式更新索引。全文文本会话负责索引更新的实体。

#1


2  

We do updates both synchronous and asynchronously depending on the kind of action the user is doing. We have implemented the synchronous indexing in a way where we use the asynchronous code and just waits for some time for its completion. We only wait for 2 seconds which means that if it takes longer then the user will not see the update but normally the user will.

我们根据用户正在执行的操作类型进行同步和异步更新。我们在使用异步代码的方式中实现了同步索引,并等待一段时间来完成它。我们只需要等待2秒,这意味着如果它需要更长的时间,用户就不会看到更新,但通常用户会看到更新。

We configured logging in a way so we would get notified whenever the "synchronous" indexing took longer than we waited to get an idea of how often it would happen. We hardly ever get over the 2 second limit.

我们以某种方式配置了日志记录,以便当“同步”索引花费的时间比我们等待的时间长时,我们会得到通知,以了解它发生的频率。我们几乎没有超过2秒的极限。

#2


0  

If you are using full text session, then you don't need to update indexs explicitly. Full text session take care of indexing updated entity.

如果使用全文会话,则不需要显式更新索引。全文文本会话负责索引更新的实体。