Hi Otis,

Currently I am creating indexes from Java standalone program. 

I am preparing data by using query & have made data to index.

Function as blow can we write.

I have large number of product & we want to user it at production level.

Please provide me sample or tutorials.


/**
     * 
     * 
     * @param pbi
     * @throws DAOException
     */
    protected Document prepareLuceneDocument(Ismpbi pbi) throws DAOException {
        long start = System.currentTimeMillis();
        Long prn = pbi.getPbirfnum();
        if (!isValidProduct(pbi)) {
            if(logger.isDebugEnabled())
                logger.debug("Product Discarded" + prn+ " not a valid product. 
");
            discarded++;
            return null;
        }

        IsmpptDAO pptDao = new IsmpptDAO();
        Set categoryList = new HashSet(pptDao.findByProductCategories(prn));

        Iterator iter = categoryList.iterator();
        Set directCategories = new HashSet();
        while (iter.hasNext()) {
            Object[] obj = (Object[]) iter.next();
            Long categoryId = (Long) obj[0];
            String categoryName = (String) obj[1];
            directCategories.add(new CategoryRecord(categoryId, categoryName));
        }

        if (directCategories.size() == 0) {
            if(logger.isDebugEnabled())
                logger.debug("Product Discarded" + prn
                        + " not placed in any category directly [ismppt].");
            discarded++;
            return null;
        }

        // Get all the categories for the direct categories - contains
        // CategoryRecord objects
        Set categories = getCategories(directCategories, prn);
        Set categoryIds = new HashSet(); // All category ids
        
        Iterator it = categories.iterator();
        while (it.hasNext()) {
            CategoryRecord rec = (CategoryRecord) it.next();
            categoryIds.add(rec.getId());
        }
        
        //All categories so far TOTAL (direct+parent categories)
        if (categoryIds.size() == 0) {
            if(logger.isDebugEnabled())
                logger.debug("Product Discarded" + prn+ " direct categories are 
not placed under other categories.");
            discarded++;
            return null;
        }

        Set catalogues = getCatalogues(prn);
        if (catalogues.size()!=0){
            if(logger.isDebugEnabled())
                logger.debug("[" + prn + "]-> Total Direct PCC Catalogues [" + 
collectionToStringNew(catalogues) +"]");
        }
        
        getCatalogueWithAllChildInCCR(prn, categoryIds, catalogues);
        if (catalogues.size() == 0) {
            if(logger.isDebugEnabled())
                logger.debug("Product Discarded " + prn+ " not attached with 
any catalogue");
            discarded++;
            return null;
        }

        String productDirectCategories = collectionToString(directCategories);
        String productAllCategories = collectionToString(categories);
        String productAllCatalogues = collectionToStringNew(catalogues);

        String categoryNames = getCategoryNames(categories);
        
        if(logger.isInfoEnabled())
            logger.info("TO Document Product " + pbi.getPbirfnum() + " Dir 
Categories " +
                  productDirectCategories + " All Categories "
                + productAllCategories + " And Catalogues "
                + productAllCatalogues);
    
        directCategories = null;
        categories=null;
        catalogues=null;
        
        
        Document document = new ProductDocument().toDocument(pbi,
                productAllCategories, productAllCatalogues,
                productDirectCategories, categoryNames);
        
        categoryNames =null;
        pbi=null;
        productAllCatalogues =null;
        productAllCategories =null;
        productDirectCategories=null;
        categoryNames=null;
        
        long time = System.currentTimeMillis() - start;
        if (time > longestIndexTime) {
            longestIndexTime = time;
        }
        return document;
    }



> Date: Mon, 22 Sep 2008 22:10:16 -0700
> From: [EMAIL PROTECTED]
> Subject: Re: Solr Using
> To: solr-user@lucene.apache.org
> 
> Dinesh,
> 
> Please have a look at the Solr tutorial first.
> Then have a look at the new DataImportHandler - there is a very detailed page 
> about it on the Wiki.
> 
> 
> Otis
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
> 
> 
> 
> ----- Original Message ----
> > From: Dinesh Gupta <[EMAIL PROTECTED]>
> > To: solr-user@lucene.apache.org
> > Sent: Tuesday, September 23, 2008 1:02:34 AM
> > Subject: Solr Using
> > 
> > 
> > 
> > Hi All,
> > 
> > I am new to Solr. I am using Lucene last 2 years.
> > 
> > We create Lucene indexes for database.
> > 
> > Please help to migrate to Solr.
> > 
> > How can achieve this.
> > 
> > If any one have idea, please help.
> > 
> > Thanks In Advance.
> > 
> > 
> > Regards,
> > Dinesh Gupta
> > 
> > _________________________________________________________________
> > Search for videos of Bollywood, Hollywood, Mollywood and every other wood, 
> > only 
> > on Live.com 
> > http://www.live.com/?scope=video&form=MICOAL
> 

_________________________________________________________________
Search for videos of Bollywood, Hollywood, Mollywood and every other wood, only 
on Live.com 
http://www.live.com/?scope=video&form=MICOAL

Reply via email to