Skip to content

Commit

Permalink
making solr flush it's partial batch if a commit is invoked.
Browse files Browse the repository at this point in the history
  • Loading branch information
kwatters committed Jul 27, 2023
1 parent f406812 commit 7899ba0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/myrobotlab/service/Solr.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,17 @@ public void deleteEmbeddedIndex() throws SolrServerException, IOException {
* @throws IOException
* boom
*/
public void startEmbedded(String path) throws SolrServerException, IOException {
public synchronized void startEmbedded(String path) throws SolrServerException, IOException {
// let's extract our default configs into the directory/
// FileIO.extract(Util.getResourceDir() , "Solr/core1", path);
// FileIO.extract(Util.getResourceDir() , "Solr/solr.xml", path +
// File.separator + "solr.xml");
// load up the solr core container and start solr

if (embeddedSolrServer != null) {
log.info("Embedded solr already running.");
return;
}

// FIXME - a bit unsatisfactory
File f = new File(getDataInstanceDir());
f.mkdirs();
Expand Down Expand Up @@ -222,6 +226,9 @@ private ProcessingStatus flushDocumentBatch(boolean forceFlush) {
*
*/
public void commit() {
// if we are explicitly calling a commit.. first flush any partial batch
// followed by the commit.
flushDocumentBatch(true);
try {
if (embeddedSolrServer != null) {
embeddedSolrServer.commit();
Expand Down

0 comments on commit 7899ba0

Please sign in to comment.