Solr conditional adds/updates?

前端 未结 3 1044
灰色年华
灰色年华 2021-01-19 22:48

I have a fairly simple need to do a conditional update in Solr, which is easily accomplished in MySQL.

For example,

  • I have 100 documents with a unique
3条回答
  •  囚心锁ツ
    2021-01-19 23:44

    I can think of two ways:

    1. Write your own UpdateHandler and override addDoc to implement that checking.
    2. Put the appropriate locks (critical sections) in your client code in order to fetch the stored document, compare the dates, and conditionally add the new document in a thread-safe manner.

    Remember that Solr is not a database, comparing it to MySQL is comparing apples and oranges.

提交回复
热议问题