Await for FTS index to update
See original GitHub issueWhen writing tests that involve the FTS engine, I’m stuck with stone age technique of thread cpu-busy loop to wait the FTS engine to index my documents.
I have tried the following :
int retry = 0;
while (cluster.searchQuery("myIndex", SearchQuery.docId(myDocument.getId())).rows().isEmpty()) {
if (retry > 60) fail("Document indexation in FTS timeout");
Thread.sleep(1000);
retry++;
}
But it gave me inconsistent results. I guess it waits for the index to acknowledge the document but the document is not yet ready to be searched. Sometimes, on a small sized machine overwhelmed by test suites, a dozen of seconds can separate acknowledgement from readiness.
Is there a common wait to deal with this ?
Edit : in my tests I’m using FTS inside a N1QL query, I don’t know if that matters.
Issue Analytics
- State:
- Created a year ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
What criteria(s) trigger the Full Text Search Index re-built?
Hey @jessyang, on new mutations the FTS index will continually be updated (it isn't re-built). When the index is building, search requests/ ...
Read more >How to automatically maintain Full-Text indexes and catalogs
We want to parameter the solution as much as possible so that we can easily change its behavior without changing the code. Available...
Read more >Improve the Performance of Full-Text Indexes - SQL Server
If the average disk-waiting queue length is more than two times the ... More important, update the statistics on the clustered index or...
Read more >How to refresh a full text index from within a SQL Server ...
I think you're out of luck. Trying to start a manual refresh inside a transaction... begin tran alter fulltext index on dbo.FTS_Table start ......
Read more >14.6.2.3 InnoDB Full-Text Indexes - MySQL :: Developer Zone
Specifically, updates and insertions on a full-text index are processed at transaction commit time, which means that a full-text search can only see...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Use this url
curl -u <username>:<password> http://<ip>:8094/api/nsstats
check for bucket_name:index_name:num_mutations_to_index = 0. In the unit tests, we use okhttp client for things like this.
“This requires the latest token from the last insert ?” I don’t believe the order that documents are inserted can be inferred from the order they were inserted. And even if they could, if the inserts are done with the reactive API, there’s no way to know the order the inserts actually occurred. One could look at the CAS, but then again, that’s another assumption.
As I mentioned earlier, there is the “num_mutations_to_index”. That will be zero when all mutations have been indexed. Is that not sufficient?