Beispiel #1
0
 public ArrayList<AppType> getAppsForRFPbyId(String userName, String rfpName, boolean searchNow)
     throws ParseException, IOException, URISyntaxException {
   // If search now, then initiate search for this rfp id
   if (searchNow) {
     populateSearchResults(userName, rfpName);
   }
   return repo.getAppsForRFPbyId(rfpName);
 }
Beispiel #2
0
  /**
   * Takes docs from the repository and indexes them. This has to be done only once
   *
   * @throws IOException
   * @throws LockObtainFailedException
   * @throws CorruptIndexException
   */
  public void indexDocs(String collection)
      throws CorruptIndexException, LockObtainFailedException, IOException {
    dir = new RAMDirectory();
    IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
    IndexWriter writer = new IndexWriter(dir, config);

    for (DBCursor it = repo.retrieveDocs(collection); it.hasNext(); ) {
      logger.info("added doc");
      addDoc(writer, it.next());
    }
    writer.close();
  }
Beispiel #3
0
  @Scheduled(fixedDelay = 300000)
  public void indexDocs() throws CorruptIndexException, LockObtainFailedException, IOException {
    String collection = DocStore.CIVIC_COMMONS_COLLECTION;
    dir = new RAMDirectory();
    IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
    IndexWriter writer = new IndexWriter(dir, config);

    DBCursor it = repo.retrieveDocs(collection);
    while (it.hasNext()) {
      logger.info("added doc from scheduler");
      addDoc(writer, it.next());
    }
    writer.close();
  }
Beispiel #4
0
 /*
  * Get the body of the RFP
  * Make that the query
  * Query the civic commons database using the 'search' method
  * Get the results i.e the apps
  */
 public boolean populateSearchResults(String userName, String rfpName)
     throws ParseException, IOException, URISyntaxException {
   // Fetch RFP from docstore
   RFPCollectionType rfp = repo.fetchRFPbyId(rfpName);
   // Search using that rfp as query in lucene indexer
   List<AppType> searchAppResults = search(rfp.getRfpBody());
   // Update RFP appList in docstore
   ArrayList<String> appList = new ArrayList<String>();
   for (AppType app : searchAppResults) {
     appList.add(app.getName());
   }
   rfp.setAppList(appList);
   // Put the updated RFP with the searchresults back into docstore
   addRFPToUser(userName, rfp);
   return true;
 }
Beispiel #5
0
 public List<RFPCollectionType> getAllRFPsForUser(String userName) {
   return repo.getAllRFPsForUser(userName);
 }
Beispiel #6
0
 public void addRFPToStore(RFPCollectionType doc) {
   repo.addDocsToStore(DocStore.RFP_COLLECTION, doc);
   logger.info("added RFP");
 }