Package com.tistory.devyongsik.crescent.collection.entity

Examples of com.tistory.devyongsik.crescent.collection.entity.CrescentCollections


  private void indexingTestData() {
   
    Handler handler = new JsonDataHandler();
    IndexingRequestForm indexingRequestForm = handler.handledData(bulkIndexingTestText);
    CrescentCollections crescentCollections = collectionHandler.getCrescentCollections();
    CrescentCollection collection = crescentCollections.getCrescentCollection("sample");
   
    String message = executor.indexing(collection, indexingRequestForm);

    System.out.println("indexing result message : " + message);
  }
View Full Code Here


  @Test
  public void loadFromXML() {
    CrescentCollectionHandler collectionHandler
      = SpringApplicationContext.getBean("crescentCollectionHandler", CrescentCollectionHandler.class);
   
    CrescentCollections collections = collectionHandler.getCrescentCollections();
   
    System.out.println(collections);
   
    Assert.assertNotNull(collections);
   
    List<CrescentCollection> collectionList = collections.getCrescentCollections();
   
    Assert.assertTrue(collectionList.size() > 0);
  }
View Full Code Here

  @Test
  public void writeToXML() {
    CrescentCollectionHandler collectionHandler
      = SpringApplicationContext.getBean("crescentCollectionHandler", CrescentCollectionHandler.class);
   
    CrescentCollections collections = collectionHandler.getCrescentCollections();
   
    System.out.println(collections);
   
    Assert.assertNotNull(collections);
   
    collectionHandler.writeToXML();
    collectionHandler.reloadCollectionsXML();
   
    CrescentCollections collections2 = collectionHandler.getCrescentCollections();
   
    System.out.println(collections2);
  }
View Full Code Here

  private CrescentCollectionHandler collectionHandler;
 
  @Override
  public CrescentCollection updateCollectionInfo(HttpServletRequest request) {
   
    CrescentCollections crescentCollections = collectionHandler.getCrescentCollections();
   
    String selectedCollectionName = request.getParameter("collectionName");

    logger.debug("selectedCollectionName : " + selectedCollectionName);

    String indexingModeAnalyzer = request.getParameter("indexingModeAnalyzer");
    String searchModeAnalyzer = request.getParameter("searchModeAnalyzer");
   
    String indexingModeAnalyzerType = request.getParameter("indexingModeAnalyzerType");
    String searchModeAnalyzerType = request.getParameter("searchModeAnalyzerType");
   
    String indexingModeAnalyzerConstArgs = request.getParameter("indexingModeAnalyzerConstArgs");
    String searchModeAnalyzerConstArgs = request.getParameter("searchModeAnalyzerConstArgs");
   
    CrescentCollection selectedCollection = crescentCollections.getCrescentCollection(selectedCollectionName);
   
    List<CrescentAnalyzerHolder> analyzerHolderList = new ArrayList<CrescentAnalyzerHolder>();
    CrescentAnalyzerHolder indexingModeAnalyzerHolder = new CrescentAnalyzerHolder();
    indexingModeAnalyzerHolder.setClassName(indexingModeAnalyzer);
    indexingModeAnalyzerHolder.setConstructorArgs(indexingModeAnalyzerConstArgs);
    indexingModeAnalyzerHolder.setType(indexingModeAnalyzerType);
    analyzerHolderList.add(indexingModeAnalyzerHolder);
   
    CrescentAnalyzerHolder searchModeAnalyzerHolder = new CrescentAnalyzerHolder();
    searchModeAnalyzerHolder.setClassName(searchModeAnalyzer);
    searchModeAnalyzerHolder.setConstructorArgs(searchModeAnalyzerConstArgs);
    searchModeAnalyzerHolder.setType(searchModeAnalyzerType);
    analyzerHolderList.add(searchModeAnalyzerHolder);
   
    selectedCollection.setAnalyzers(analyzerHolderList);
   
    selectedCollection.setSearcherReloadScheduleMin(StringUtils.defaultIfEmpty(request.getParameter("searcherReloadScheduleMin"), "10"));

    if(logger.isDebugEnabled()) {
      logger.debug("analyzer : {} ", request.getParameter("analyzer"));
      logger.debug("collection Name : {} ", request.getParameter("collectionName"));
      logger.debug("indexing Directory : {} ", request.getParameter("indexingDirectory"));
      logger.debug("searcher reload schedule min : {} ", request.getParameter("searcherReloadScheduleMin"));
      logger.debug("indexingModeAnalyzer : {} ", request.getParameter("indexingModeAnalyzer"));
      logger.debug("searchModeAnalyzer : {} ", request.getParameter("searchModeAnalyzer"));
      logger.debug("indexingModeAnalyzerType : {} ", request.getParameter("indexingModeAnalyzerType"));
      logger.debug("searchModeAnalyzerType : {} ", request.getParameter("searchModeAnalyzerType"));
      logger.debug("indexingModeAnalyzerConstArgs : {} ", request.getParameter("indexingModeAnalyzerConstArgs"));
      logger.debug("searchModeAnalyzerConstArgs : {} ", request.getParameter("searchModeAnalyzerConstArgs"));
    }

    List<CrescentCollectionField> crescentCollectionFieldList = selectedCollection.getFields();

    //추가되는 필드명을 모은다.
    @SuppressWarnings("unchecked")
    Enumeration<String> enumeration = request.getParameterNames();
    List<String> addFieldNameList = new ArrayList<String>();
    while(enumeration.hasMoreElements()) {
      String paramValue = enumeration.nextElement();
      if(paramValue.endsWith("fieldName")) {
        addFieldNameList.add(paramValue.substring(0, paramValue.lastIndexOf("-")));
      }
    }

    logger.debug("add field name list : {}", addFieldNameList);

    for(String fieldName :addFieldNameList) {
      CrescentCollectionField crescentField = new CrescentCollectionField();
      crescentField.setName(fieldName);
     
      if(!crescentCollectionFieldList.contains(crescentField)) {
        crescentCollectionFieldList.add(crescentField);
      }
    }
       
    for(CrescentCollectionField crescentField : crescentCollectionFieldList) {

      crescentField.setAnalyze("on".equals(request.getParameter(crescentField.getName()+"-analyze")) ? true : false);
      crescentField.setIndex("on".equals(request.getParameter(crescentField.getName()+"-index")) ? true : false);
      crescentField.setMust("on".equals(request.getParameter(crescentField.getName()+"-must")) ? true : false);
      crescentField.setStore("on".equals(request.getParameter(crescentField.getName()+"-store")) ? true : false);
      crescentField.setTermoffset("on".equals(request.getParameter(crescentField.getName()+"-termoffset")) ? true : false);
      crescentField.setTermposition("on".equals(request.getParameter(crescentField.getName()+"-termposition")) ? true : false);
      crescentField.setTermvector("on".equals(request.getParameter(crescentField.getName()+"-termvector")) ? true : false);
      crescentField.setRemoveHtmlTag("on".equals(request.getParameter(crescentField.getName()+"-removeHtmlTag")) ? true : false);

      crescentField.setBoost(Float.parseFloat(StringUtils.defaultString(request.getParameter(crescentField.getName()+"-boost"), "0")));
      crescentField.setType(StringUtils.defaultString(request.getParameter(crescentField.getName()+"-type"), "STRING"));


      //sort field 처리
      if("on".equals(request.getParameter(crescentField.getName()+"-sortField"))) {
        CrescentSortField sortField = new CrescentSortField();
        sortField.setSource(crescentField.getName());
        sortField.setDest(crescentField.getName()+"_sort");

        if(selectedCollection.getSortFields().contains(sortField)) {
          //Nothing
        } else {
          selectedCollection.getSortFields().add(sortField);
        }
      }

      //default search field 처리
      if("on".equals(request.getParameter(crescentField.getName()+"-defaultSearchField"))) {
        CrescentDefaultSearchField defaultSearchField = new CrescentDefaultSearchField();
        defaultSearchField.setName(crescentField.getName());

        if(selectedCollection.getDefaultSearchFields().contains(defaultSearchField)) {
          //Nothing
        } else {
          selectedCollection.getDefaultSearchFields().add(defaultSearchField);
        }
      }

      if(logger.isDebugEnabled()) {
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "sortField : " + request.getParameter(crescentField.getName()+"-sortField"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "defaultSearchField : "+ request.getParameter(crescentField.getName()+"-defaultSearchField"));
      }

      if(logger.isDebugEnabled()) {
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "analyze : " + request.getParameter(crescentField.getName()+"-analyze"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "index : " + request.getParameter(crescentField.getName()+"-index"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "must : " + request.getParameter(crescentField.getName()+"-must"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "store : " + request.getParameter(crescentField.getName()+"-store"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "termoffset : " + request.getParameter(crescentField.getName()+"-termoffset"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "termposition : " + request.getParameter(crescentField.getName()+"-termposition"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "termvector : " + request.getParameter(crescentField.getName()+"-termvector"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "boost : " + request.getParameter(crescentField.getName()+"-boost"));
        logger.debug("crescentField Name {} = {}", crescentField.getName(), "type : " + request.getParameter(crescentField.getName()+"-type"));
      }
    }
     
    collectionHandler.writeToXML();
    collectionHandler.reloadCollectionsXML();
   
    crescentCollections = collectionHandler.getCrescentCollections();
    selectedCollection = crescentCollections.getCrescentCollection(selectedCollectionName);
   
    return selectedCollection;
  }
View Full Code Here

  }
 
  @Override
  public void deleteCollectionInfo(String collectionName) {

    CrescentCollections collections = collectionHandler.getCrescentCollections();
    List<CrescentCollection> collectionList = collections.getCrescentCollections();
   
    int targetIndex = -1;
   
    for(int index = 0; index < collectionList.size(); index++) {
      if(collectionName.equals(collectionList.get(index).getName())) {
View Full Code Here

  private CrescentCollectionHandler collectionHandler;

  @RequestMapping("/searchTestMain")
  public ModelAndView searchTestMain(HttpServletRequest request, HttpServletResponse response) throws Exception {
   
    CrescentCollections crescentCollections = collectionHandler.getCrescentCollections();
   
    String selectedCollectionName = request.getParameter("col_name");
    if(selectedCollectionName == null) {
      selectedCollectionName = crescentCollections.getCrescentCollections().get(0).getName();
    }
   
    ModelAndView modelAndView = new ModelAndView();
    //modelAndView.addObject("crescentCollections", crescentCollections);
    modelAndView.addObject("selectedCollectionName", selectedCollectionName);
   
    List<CrescentCollection> crescentCollectionList = crescentCollections.getCrescentCollections();
   
    modelAndView.addObject("crescentCollectionList", crescentCollectionList);
    modelAndView.addObject("selectedCollection", crescentCollections.getCrescentCollection(selectedCollectionName));
    modelAndView.setViewName("/admin/searchTestMain");
   
    logger.debug("search Test main");

    return modelAndView;
View Full Code Here

    userRequest.put("ft", searchRequest.getFilter());
    userRequest.put("rq", searchRequest.getRegexQuery());

    SearchResult searchResult = searchService.search(searchRequest);
   
    CrescentCollections crescentCollections = collectionHandler.getCrescentCollections();
   
    String selectedCollectionName = request.getParameter("col_name");
    if(selectedCollectionName == null) {
      selectedCollectionName = crescentCollections.getCrescentCollections().get(0).getName();
    }
   
    ModelAndView modelAndView = new ModelAndView();
    //modelAndView.addObject("crescentCollections", crescentCollections);
    modelAndView.addObject("selectedCollectionName", selectedCollectionName);
   
    List<CrescentCollection> crescentCollectionList = crescentCollections.getCrescentCollections();
   
    modelAndView.addObject("crescentCollectionList", crescentCollectionList);
    modelAndView.addObject("selectedCollection", crescentCollections.getCrescentCollection(selectedCollectionName));
   
    modelAndView.addObject("searchResult", searchResult);
    modelAndView.addObject("USER_REQUEST", userRequest);
    modelAndView.setViewName("/admin/searchTestMain");
View Full Code Here

  private CrescentCollectionHandler collectionHandler;

  @RequestMapping("/morphMain")
  public ModelAndView morphMain(HttpServletRequest request, HttpServletResponse response) throws Exception {
   
    CrescentCollections crescentCollections = collectionHandler.getCrescentCollections();
   
    String selectedCollectionName = request.getParameter("col_name");
    if(selectedCollectionName == null) {
      selectedCollectionName = crescentCollections.getCrescentCollections().get(0).getName();
    }
   
    ModelAndView modelAndView = new ModelAndView();
    //modelAndView.addObject("crescentCollections", crescentCollections);
    modelAndView.addObject("selectedCollectionName", selectedCollectionName);
   
    List<CrescentCollection> crescentCollectionList = crescentCollections.getCrescentCollections();
   
    modelAndView.addObject("crescentCollectionList", crescentCollectionList);
    modelAndView.addObject("selectedCollection", crescentCollections.getCrescentCollection(selectedCollectionName));
   
    modelAndView.setViewName("/admin/morphMain");

    return modelAndView;
  }
View Full Code Here

  @RequestMapping("/doMorphTest")
  public ModelAndView morphTest(HttpServletRequest request, HttpServletResponse response) throws Exception {
   
    String keyword = request.getParameter("keyword");
   
    CrescentCollections crescentCollections = collectionHandler.getCrescentCollections();
   
    String selectedCollectionName = request.getParameter("col_name");
    if(selectedCollectionName == null) {
      selectedCollectionName = crescentCollections.getCrescentCollections().get(0).getName();
    }
   
    ModelAndView modelAndView = new ModelAndView();
    //modelAndView.addObject("crescentCollections", crescentCollections);
    modelAndView.addObject("selectedCollectionName", selectedCollectionName);
   
    List<CrescentCollection> crescentCollectionList = crescentCollections.getCrescentCollections();
   
    modelAndView.addObject("crescentCollectionList", crescentCollectionList);
    modelAndView.addObject("selectedCollection", crescentCollections.getCrescentCollection(selectedCollectionName));
   
   
    logger.debug("keyword : {}, collectionName : {}", keyword, selectedCollectionName);
   
    List<MorphToken> resultTokenListIndexingMode = morphService.getTokens(keyword, true, selectedCollectionName);
View Full Code Here

    String keyword = request.getParameter("keyword");
    String selectedCollectionName = request.getParameter("collectionName");
   
    logger.debug("keyword : {}, collectionName : {}", keyword, selectedCollectionName);
   
    CrescentCollections crescentCollections = collectionHandler.getCrescentCollections();
   
    if(selectedCollectionName == null) {
      selectedCollectionName = crescentCollections.getCrescentCollections().get(0).getName();
    }
   
    List<MorphToken> resultTokenListIndexingMode = morphService.getTokens(keyword, true, selectedCollectionName);
    List<MorphToken> resultTokenListQueryMode = morphService.getTokens(keyword, false, selectedCollectionName);
   
View Full Code Here

TOP

Related Classes of com.tistory.devyongsik.crescent.collection.entity.CrescentCollections

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.