Examples of Op


Examples of railo.runtime.search.lucene2.query.Op

        try {
         
            if(type!=SEARCH_TYPE_SIMPLE) throw new SearchException("search type explicit not supported");
            Analyzer analyzer = SearchUtil.getAnalyzer(language);
            Query query=null;
            Op op=null;
            Object highlighter=null;
            railo.runtime.search.lucene2.query.QueryParser queryParser=new railo.runtime.search.lucene2.query.QueryParser();
      AddionalAttrs aa = AddionalAttrs.getAddionlAttrs();
      aa.setHasRowHandling(true);
      int startrow=aa.getStartrow();
      int maxrows=aa.getMaxrows();
     
     
      if(!criteria.equals("*")) {
        // FUTURE take this data from calling parameters
        op=queryParser.parseOp(criteria);
        if(op==null) criteria="*";
        else criteria=op.toString();
        try {
         
          query = new QueryParser("contents",analyzer ).parse(criteria);
          highlighter = Highlight.createHighlighter(query,aa.getContextHighlightBegin(),aa.getContextHighlightEnd());
         
               
        }
              catch (ParseException e) {
          throw new SearchException(e);
        }
      }
     
      Resource[] files = _getIndexDirectories();
     
            if(files==null) return new SearchResulItem[0];
            ArrayList<SearchResulItem> list=new ArrayList<SearchResulItem>();
            String ct,c;
           
            ArrayList<String> spellCheckIndex=spellcheck?new ArrayList<String>():null;
           
            int count=0;
            IndexReader reader = null;
            Searcher searcher = null;
            try {
              outer:for(int i=0;i<files.length;i++) {
              if(removeCorrupt(files[i]))continue;
                String strFile=files[i].toString();
                SearchIndex si = indexes.get(files[i].getName());
               
                if(si==null)continue;
                ct=si.getCategoryTree();
                c=ListUtil.arrayToList(si.getCategories(), ",");
               
                // check category tree
                if(!matchCategoryTree(ct,categoryTree))continue;
                if(!matchCategories(si.getCategories(),category))continue;
               
                Document doc;
                String id=files[i].getName();
                data.addRecordsSearched(_countDocs(strFile));
               
                reader = _getReader(id,false);
                if(query==null && "*".equals(criteria)) {
                  int len=reader.numDocs();
                  for(int y=0;y<len;y++) {
                    if(startrow>++count)continue;
                    if(maxrows>-1 && list.size()>=maxrows) break outer;
                    doc = reader.document(y);
                    list.add(createSearchResulItem(highlighter,analyzer,doc,id,1,ct,c,aa.getContextPassages(),aa.getContextBytes()));
                  }
                }
                else {
                  if(spellcheck)spellCheckIndex.add(id);
                  // search
                  searcher = new IndexSearcher(reader);
                    Hits hits = searcher.search(query);
                  int len=hits.length();
                  for (int y=0; y<len; y++) {
                    if(startrow>++count)continue;
                    if(maxrows>-1 && list.size()>=maxrows) break outer;
                    //list.add(new SearchResulItemHits(hits,y,highlighter,analyzer,id,ct,c,aa.getContextPassages(),aa.getContextBytes()));
                    doc = hits.doc(y);
                    list.add(createSearchResulItem(highlighter,analyzer,doc,id,hits.score(y),ct,c,aa.getContextPassages(),aa.getContextBytes()));
                 
                
                }
              
            }
            }
          finally {
            close(reader);
            close(searcher);
          }  
           
            // spellcheck
            //SearchData data=ThreadLocalSearchData.get();
            if(spellcheck && data!=null) {
              if(data.getSuggestionMax()>=list.size()) {
               
                Map suggestions = data.getSuggestion();
                Iterator it = spellCheckIndex.iterator();
                String id;
                Literal[] literals = queryParser.getLiteralSearchedTerms();
                String[] strLiterals = queryParser.getStringSearchedTerms();
                boolean setSuggestionQuery=false;
                while(it.hasNext()) {
                  id=(String) it.next();
                  // add to set to remove duplicate values
                  SuggestionItem si;
                  SpellChecker sc = getSpellChecker(id);
                  for(int i=0;i<strLiterals.length;i++) {
                    String[] arr = sc.suggestSimilar(strLiterals[i], 1000);
                    if(arr.length>0){
                      literals[i].set("<suggestion>"+arr[0]+"</suggestion>");
                      setSuggestionQuery=true;
                     
                      si=(SuggestionItem) suggestions.get(strLiterals[i]);
                      if(si==null)suggestions.put(strLiterals[i],new SuggestionItem(arr));
                      else si.add(arr);
                    }
                  }
              }
                if(setSuggestionQuery)data.setSuggestionQuery(op.toString());
              }
            }
           
          return list.toArray(new SearchResulItem[list.size()]);
        }
View Full Code Here

Examples of urban.kappa.Op

   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetOp(Op newOp, NotificationChain msgs)
  {
    Op oldOp = op;
    op = newOp;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, KappaPackage.ATOM__OP, oldOp, newOp);
      if (msgs == null) msgs = notification; else msgs.add(notification);
View Full Code Here

Examples of urban.urban.Op

        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case UrbanPackage.OP:
      {
        Op op = (Op)theEObject;
        T result = caseOp(op);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      default: return defaultCase(theEObject);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.