Package org.dbpedia.spotlight.exceptions

Examples of org.dbpedia.spotlight.exceptions.IndexException


    public void add(SurfaceForm surfaceForm, DBpediaResource resource) throws IndexException {
        Document newDoc = mLucene.createDocument(surfaceForm, resource);
        try {
            mWriter.addDocument(newDoc); // do not commit for faster indexing.
        } catch (IOException e) {
            throw new IndexException("Error adding candidate map to the index. ", e);
        }

        LOG.trace("Added to " + mLucene.directory().toString() + ": " + surfaceForm.toString() + " -> " + resource.toString());
    }
View Full Code Here


            newDoc.add(mLucene.getField(surfaceForms.get(i)));
        }
        try {
            mWriter.addDocument(newDoc); // do not commit for faster indexing.
        } catch (IOException e) {
            throw new IndexException("Error adding candidate map to the index. ", e);
        }

        LOG.trace("Added to " + mLucene.directory().toString() + ": " + surfaceForms.toString() + " -> " + resource.toString());
    }
View Full Code Here

    public void add(SurfaceForm surfaceForm, DBpediaResource resource, int nTimes) throws IndexException {
        Document newDoc = mLucene.createDocument(surfaceForm, resource, nTimes);
        try {
            mWriter.addDocument(newDoc); //TODO ATTENTION need to merge with existing doc if URI is already in index
        } catch (IOException e) {
            throw new IndexException("Error adding candidate map to the index. ", e);
        }

        LOG.trace("Added to " + mLucene.directory().toString() + ": " + surfaceForm.toString() + " -> " + resource.toString());
    }
View Full Code Here

            try {
                LOG.info("Now committing...");
                mWriter.commit();
                LOG.info("Commit done.");
            } catch (Exception e) {
                throw new IndexException("Error running commit.",e);
            }

            /*
            Since Lucene 2.9 you don’t need to optimize in most cases, as search is working per-segment.
            Optimizing an index should only be done during maintenance or if you want to ship a static index e.g. on a DVD.
View Full Code Here

            LOG.info(String.format("Merge done (%s) resources merged).",percent));
            numMerges++;

            searcher.close();
        } catch (IOException e) {
            throw new IndexException(e);
        } catch (SearchException e) {
            throw new IndexException(e);
        }
    }
View Full Code Here

                Document docForResource = uriToDocumentMap.get(uri);
                mWriter.addDocument(docForResource);
                numSavedDocs++;
            }
        } catch (IOException e) {
            throw new IndexException(e);
        }
        LOG.info(String.format("Saved %s resources to lucene index.",numSavedDocs));
    }
View Full Code Here

        try {
            mWriter.commit();
            LOG.info("Expunge deletes...");
            mWriter.expungeDeletes();
        } catch (IOException e) {
            throw new IndexException("Error while performing final commit for index enrichment.", e);
        }
        //LOG.info("Optimizing...");
        //mWriter.optimize();
        LOG.info("Done.");
    }
View Full Code Here

        //LOG.debug("Indexing occurrence");
        Document newDoc = mLucene.createDocument(resourceOccurrence);
        try {
            mWriter.addDocument(newDoc); // do not commit for faster indexing.
        } catch (IOException e) {
            throw new IndexException("Error adding occurrence to the index. ",e);
        }
    }
View Full Code Here

                addOccurrence(resourceOccurrence);
            }
            mWriter.commit(); //Commit for every occurrence is not efficient, but we do because we merge every new occurrence into a resource.
            searcher.close();
        } catch (IOException e) {
            throw new IndexException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.dbpedia.spotlight.exceptions.IndexException

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.