Examples of LuceneIndexer


Examples of com.liferay.portal.util.LuceneIndexer

      _companyId = ctx.getInitParameter("company_id");

      if (GetterUtil.getBoolean(
          PropsUtil.get(PropsUtil.INDEX_ON_STARTUP))) {

        _indexer = new LuceneIndexer(_companyId);

        if (GetterUtil.getBoolean(
            PropsUtil.get(PropsUtil.INDEX_WITH_THREAD))) {

          _indexerThread = new Thread(
View Full Code Here

Examples of it.eng.spagobi.commons.utilities.indexing.LuceneIndexer

        String name = SingletonConfig.getInstance().getConfigValue("INDEX_INITIALIZATION.name");
        //first checks if iindex exists
        File idxFile = new File(location+name);
        if(!idxFile.exists()){
          logger.debug("Creating index");
          LuceneIndexer indexer = new LuceneIndexer();
          try {
          indexer.createIndex(idxFile);
        } catch (CorruptIndexException e) {
          logger.error("Index corrupted "+e.getMessage(), e);
        } catch (IOException e) {
          logger.error(e.getMessage(), e);
        }
View Full Code Here

Examples of it.eng.spagobi.commons.utilities.indexing.LuceneIndexer

    SbiObjects exportedObj = null;
    try {
      List exportedBIObjs = importer.getAllExportedSbiObjects(sessionExpDB, "SbiObjects", "label");
      Iterator iterSbiObjs = exportedBIObjs.iterator();
     
        LuceneIndexer indexer = new LuceneIndexer();
       
      while (iterSbiObjs.hasNext()) {
        exportedObj = (SbiObjects) iterSbiObjs.next();
        Integer expId = exportedObj.getBiobjId();
        Integer existingObjId = null;
        Map objIdAss = metaAss.getBIobjIDAssociation();
        Set objIdAssSet = objIdAss.keySet();
        if (objIdAssSet.contains(expId) && !overwrite) {
          metaLog.log("Exported biobject "+exportedObj.getName()+" not inserted" +
          " because it has the same label of an existing biobject");
          continue;
        } else {
          existingObjId = (Integer) objIdAss.get(expId);
        }

        SbiObjects obj = null;
        if (existingObjId != null) {
          logger.info("The document with label:[" + exportedObj.getLabel() + "] is just present. It will be updated.");
          metaLog.log("The document with label = [" + exportedObj.getLabel() + "] will be updated.");
          obj = ImportUtilities.modifyExistingSbiObject(exportedObj, sessionCurrDB, existingObjId);
          ImportUtilities.associateWithExistingEntities(obj, exportedObj, sessionCurrDB, importer, metaAss);
          sessionCurrDB.update(obj);
        } else {
          obj = ImportUtilities.makeNewSbiObject(exportedObj);
          ImportUtilities.associateWithExistingEntities(obj, exportedObj, sessionCurrDB, importer, metaAss);
          // insert document
          Integer newId = (Integer) sessionCurrDB.save(obj);
          metaLog.log("Inserted new biobject " + obj.getName());
          metaAss.insertCoupleBIObj(expId, newId);
        }
        // manage object template
        insertObjectTemplate(obj, exportedObj.getBiobjId());
        // manage sub_object here
        insertSubObject(obj, exportedObj);
        // manage snapshot here
        insertSnapshot(obj, exportedObj);
        // insert object into folders tree
        importFunctObject(exportedObj.getBiobjId());
        // puts parameters into object
        importBIObjPar(exportedObj.getBiobjId());
        // puts dependencies into object
        importObjParUse(exportedObj.getBiobjId());

        commit();

        //updates lucene index
          BIObjectDAOHibImpl daoObj = (BIObjectDAOHibImpl)DAOFactory.getBIObjectDAO();
          BIObject biObj = daoObj.toBIObject(obj);
        indexer.addBiobjToIndex(biObj);

        // TODO controllare che fa questo e se serve!!!
        //updateSubObject(obj, exportedObj.getBiobjId());
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.apache.xindice.core.indexer.LuceneIndexer

            IndexPattern pattern = new IndexPattern(symbols, ps, nsMap);

            // check if there is full text indexer for this collection
            Indexer idx = context.getIndexManager().getBestIndexer(Indexer.STYLE_FULLTEXT, pattern);
            if (idx instanceof LuceneIndexer) {
                LuceneIndexer textInd = ((LuceneIndexer) idx);
                analyzer = textInd.getAnalyzer();
                parameters.put(PARAM_ANALYZER, analyzer);

                // see if index has matching pattern
                String alias = textInd.getPatternAlias(pattern);

                if (alias != null) {
                    // Queries that contain 'NOT', '!', '-' operators cannot be used here
                    // because LuceneIndexer searches for documents, in that context
                    // "NOT term" query means to find documents where 'term' does not
                    // appear in certain field at all. For XPath, however, it means that
                    // 'term' must not appear in text of the element that currently under
                    // evaluation, but may appear in the other elements that match the
                    // same IndexPattern.
                    //
                    // To make sure that all potentially matching documents are returned
                    // by the search, all subqueries with these operators are ignored
                    // on this step.
                    org.apache.lucene.search.Query parsedQuery = new SpecialQueryParser(alias, analyzer).parse(query);
                    IndexMatch[] matches = textInd.queryMatches(parsedQuery);
                    Key[] keys = QueryEngine.getUniqueKeys(matches);

                    return new NamedKeys(ps, ps.indexOf('@') != -1, keys);
                }
            } else {
View Full Code Here

Examples of org.apache.xindice.core.indexer.LuceneIndexer

            String alias = (String) i.next();
            config += "<pattern pattern='" + patterns.get(alias) + "' alias='" + alias + "' />";
        }
        config += "</index>";

        LuceneIndexer ind = (LuceneIndexer) collection.createIndexer(new Configuration(DOMParser.toDocument(config)));
        Thread.sleep(2000);
        return ind;
    }
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.