Hi Dinesh,

Your code is hardly useful to us since we don't know what you are trying to
achieve or what all those Dao classes do.

Look at the Solr tutorial first -- http://lucene.apache.org/solr/
Use the SolrJ client for communicating with Solr server --
http://wiki.apache.org/solr/Solrj
Also take a look at DataImportHandler which can help avoid all this code --
http://wiki.apache.org/solr/DataImportHandler

If you face any problem, first search this mailing list through markmail.orgor
nabble.com to find previous posts related to your issue. If you don't find
anything helpful, post specific questions here which we will help answer.

On Tue, Sep 23, 2008 at 3:56 PM, Dinesh Gupta <[EMAIL PROTECTED]>wrote:

>
>
>
>
>
> 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
>



-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to