use of com.pratilipi.data.SearchAccessor in project pratilipi by Pratilipi.
the class PratilipiDataUtil method _updatePratilipiSearchIndex.
private static void _updatePratilipiSearchIndex(List<Pratilipi> pratilipiList) throws InvalidArgumentException, UnexpectedServerException {
DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
SearchAccessor searchAccessor = DataAccessorFactory.getSearchAccessor();
List<PratilipiData> pratilipiDataList = new ArrayList<>(pratilipiList.size());
for (Pratilipi pratilipi : pratilipiList) {
if (pratilipi.getState() == PratilipiState.PUBLISHED) {
Author author = dataAccessor.getAuthor(pratilipi.getAuthorId());
pratilipiDataList.add(createPratilipiData(pratilipi, author, true));
} else {
searchAccessor.deletePratilipiDataIndex(pratilipi.getId());
}
}
if (pratilipiDataList.size() > 0) {
Map<PratilipiData, String> pratilipiDataKeywordsMap = new HashMap<>();
for (PratilipiData pratilipiData : pratilipiDataList) pratilipiDataKeywordsMap.put(pratilipiData, getPratilipiKeywords(pratilipiData.getId()));
searchAccessor.indexPratilipiDataList(pratilipiDataKeywordsMap);
}
}
use of com.pratilipi.data.SearchAccessor in project pratilipi by Pratilipi.
the class DataStoreUtil method main.
public static void main(String... args) throws IOException, UnexpectedServerException, InterruptedException, ParseException {
RemoteApiOptions options = new RemoteApiOptions().server("m.gamma.pratilipi.com", 80).useServiceAccountCredential("prod-pratilipi@appspot.gserviceaccount.com", "PrivateKey.p12").remoteApiPath("/remote_api");
RemoteApiInstaller installer = new RemoteApiInstaller();
installer.install(options);
ObjectifyService.begin();
Memcache memcache = DataAccessorFactory.getL2CacheAccessor();
GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
SearchAccessor searchAccessor = DataAccessorFactory.getSearchAccessor();
BlobAccessor blobAccessor = DataAccessorFactory.getBlobAccessor();
DocAccessor docAccessor = DataAccessorFactory.getDocAccessor();
// START
// END
installer.uninstall();
}
use of com.pratilipi.data.SearchAccessor in project pratilipi by Pratilipi.
the class AuthorDataUtil method updateAuthorSearchIndex.
public static void updateAuthorSearchIndex(Long authorId) throws UnexpectedServerException {
DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
SearchAccessor searchAccessor = DataAccessorFactory.getSearchAccessor();
Author author = dataAccessor.getAuthor(authorId);
if (author.getState() == AuthorState.ACTIVE) {
User user = author.getUserId() == null ? null : dataAccessor.getUser(author.getUserId());
searchAccessor.indexAuthorData(createAuthorData(author), UserDataUtil.createUserData(user));
} else {
searchAccessor.deleteAuthorDataIndex(authorId);
}
}
Aggregations