public boolean validateIndex(Book document) { return document.getIndexStatus().equals(IndexStatus.DONE); }
/** if current document is indexed then go to search else go to download index page * * @return required Intent */ public Intent getSearchIntent(Book document) { IndexStatus indexStatus = document.getIndexStatus(); Log.d(TAG, "Index status:"+indexStatus); Activity currentActivity = CurrentActivityHolder.getInstance().getCurrentActivity(); if (indexStatus.equals(IndexStatus.DONE)) { Log.d(TAG, "Index status is DONE"); return new Intent(currentActivity, Search.class); } else { Log.d(TAG, "Index status is NOT DONE"); return new Intent(currentActivity, SearchIndex.class); } }
/** this custom index creation has been optimised for slow, low memory devices * If an index is in progress then nothing will happen */ public void ensureIndexCreation(Book book) throws BookException { log.debug("ensureIndexCreation"); // ensure this isn't just the user re-clicking the Index button if (!book.getIndexStatus().equals(IndexStatus.CREATING) && !book.getIndexStatus().equals(IndexStatus.SCHEDULED)) { IndexCreator ic = new IndexCreator(); ic.scheduleIndexCreation(book); } }
public Book getDefaultBibleWithStrongs() { List<Book> bibles = getBibles(); for (Book book : bibles) { if (book.hasFeature(FeatureType.STRONGS_NUMBERS)) { if (book.getIndexStatus().equals(IndexStatus.DONE)) { return book; } } } return null; }
while (!IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus()) && attempts++<6) { CommonUtils.pause(2); if (IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus())) { Log.i(TAG, "Index created"); Intent intent;
/** ensure a book is indexed and the index contains typical Greek or Hebrew Strongs Numbers */ private boolean checkStrongs(Book bible) { try { return bible.getIndexStatus().equals(IndexStatus.DONE) && (bible.find("+[Gen 1:1] strong:h7225").getCardinality()>0 || bible.find("+[John 1:1] strong:g746").getCardinality()>0 || bible.find("+[Gen 1:1] strong:g746").getCardinality()>0); } catch (BookException be) { Log.e(TAG, "Error checking strongs numbers", be); return false; } }
public void testFindAllStrongsRef() { List<Book> bibles = Books.installed().getBooks(BookFilters.getBibles()); for (Book book : bibles) { try { if (book.hasFeature(FeatureType.STRONGS_NUMBERS)) { if (!book.getIndexStatus().equals(IndexStatus.DONE)) { System.out.println("Unindexed:"+book); } else { Key resultsH = book.find("+[Gen 1:1] strong:h7225"); //beginning Key resultsG = book.find("+[John 1:1] strong:g746"); //beginning Key resultsGOT = book.find("+[Gen 1:1] strong:g746"); //beginning if (resultsH.getCardinality()==0 && resultsG.getCardinality()==0 && resultsGOT.getCardinality()==0) { System.out.println("No refs returned in"+book.getInitials()); } else { System.out.println("Ok:"+book.getInitials()+" "+resultsH.getCardinality()+"/"+resultsG.getCardinality()+ "/" + resultsGOT.getCardinality()); } // assertTrue("No refs returned in"+book.getInitials(), resultsH.getCardinality()>0 || resultsG.getCardinality()>0); } } } catch (Exception e) { System.out.println("Error:"+book.getInitials()+":"+e.getMessage()); } } }