Examples of IndexConfiguration


Examples of org.apache.lenya.lucene.IndexConfiguration

     *   <li>unchanged documents, to be left alone, or</li>
     *   <li>new documents, to be indexed.</li>
     * </ol>
     */
    public void indexDocument(File file) throws Exception {
        IndexConfiguration config = new IndexConfiguration(configFileName);
        log.debug("File: " + file);

        File dumpDir = new File(config.resolvePath(config.getHTDocsDumpDir()));
        log.debug("Dump dir: " + dumpDir);

        File indexDir = new File(config.resolvePath(config.getIndexDir()));
        log.debug("Index dir: " + indexDir);


  String id = IndexIterator.createID(file, dumpDir);

View Full Code Here

Examples of org.apache.lenya.lucene.IndexConfiguration

                System.err.println("Usage: " + usage);

                return;
            }

            IndexConfiguration ie = new IndexConfiguration(argv[0]);
            index = ie.resolvePath(ie.getIndexDir());
            root = new File(ie.resolvePath(ie.getHTDocsDumpDir()));

            if (ie.getUpdateIndexType().equals("new")) {
                create = true;
            } else if (ie.getUpdateIndexType().equals("incremental")) {
                create = false;
            } else {
                System.err.println("ERROR: No such update-index/@type: " + ie.getUpdateIndexType());

                return;
            }

            Date start = new Date();

            Indexer indexer = (Indexer) ie.getIndexerClass().newInstance();

            DOMUtil du = new DOMUtil();
            String path = argv[0];
           
            Document config = DocumentHelper.readDocument(new File(path));
View Full Code Here

Examples of org.apache.stanbol.enhancer.engines.lucenefstlinking.IndexConfiguration

            + "' from SolrServer "+server, core);
        yard = new SolrYard(server,config,null);
        //setup the index configuration
        LanguageConfiguration langConf = new LanguageConfiguration("not.used",
            new String[]{"en;field=dbpedia-ont:surfaceForm;generate=true"});
        fstConfig = new IndexConfiguration(langConf, core, FieldEncodingEnum.SolrYard);
        fstConfig.setExecutorService(Executors.newFixedThreadPool(1));
        fstConfig.setTypeField("rdf:type");
        fstConfig.setRankingField("entityhub:entityRank");
        //fstConfig.setEntityCacheManager(new FastLRUCacheManager(2048));
        //activate the FST config
View Full Code Here

Examples of org.hbasene.index.create.IndexConfiguration

    LOG.info("To index into " + perm);

    // delete old, if any
    fs.delete(perm, true);

    final IndexConfiguration indexConf = new IndexConfiguration();
    String content = job.get("hbase.index.conf");
    if (content != null) {
      indexConf.addFromXML(content);
    }

    String analyzerName = indexConf.getAnalyzerName();
    Analyzer analyzer;
    try {
      Class<? extends Analyzer> analyzerClass = Class.forName(analyzerName)
          .asSubclass(Analyzer.class);
      Constructor<? extends Analyzer> analyzerCtor = analyzerClass
          .getConstructor(Version.class);

      analyzer = analyzerCtor.newInstance(Version.LUCENE_30);
    } catch (Exception e) {
      throw new IOException("Error in creating an analyzer object "
          + analyzerName);
    }

    // build locally first
    final IndexWriter writer = new IndexWriter(FSDirectory.open(new File(fs
        .startLocalOutput(perm, temp).toString())), analyzer, true,
        IndexWriter.MaxFieldLength.LIMITED);

    // no delete, so no need for maxBufferedDeleteTerms
    writer.setMaxBufferedDocs(indexConf.getMaxBufferedDocs());
    writer.setMaxFieldLength(indexConf.getMaxFieldLength());
    writer.setMaxMergeDocs(indexConf.getMaxMergeDocs());
    writer.setMergeFactor(indexConf.getMergeFactor());
    String similarityName = indexConf.getSimilarityName();
    if (similarityName != null) {
      try {
        Class<? extends Similarity> similarityClass = Class.forName(
            similarityName).asSubclass(Similarity.class);
        Constructor<? extends Similarity> ctor = similarityClass
            .getConstructor(Version.class);
        Similarity similarity = ctor.newInstance(Version.LUCENE_30);
        writer.setSimilarity(similarity);
      } catch (Exception e) {
        throw new IOException("Error in creating a similarity object "
            + similarityName);
      }
    }
    writer.setUseCompoundFile(indexConf.isUseCompoundFile());

    return new RecordWriter<ImmutableBytesWritable, LuceneDocumentWrapper>() {
      AtomicBoolean closed = new AtomicBoolean(false);
      private long docCount = 0;

      public void write(ImmutableBytesWritable key, LuceneDocumentWrapper value)
          throws IOException {
        // unwrap and index doc
        Document doc = value.get();
        writer.addDocument(doc);
        docCount++;
        progress.progress();
      }

      public void close(final Reporter reporter) throws IOException {
        // spawn a thread to give progress heartbeats
        Thread prog = new Thread() {
          @Override
          public void run() {
            while (!closed.get()) {
              try {
                reporter.setStatus("closing");
                Thread.sleep(1000);
              } catch (InterruptedException e) {
                continue;
              } catch (Throwable e) {
                return;
              }
            }
          }
        };

        try {
          prog.start();

          // optimize index
          if (indexConf.doOptimize()) {
            if (LOG.isInfoEnabled()) {
              LOG.info("Optimizing index.");
            }
            writer.optimize();
          }
View Full Code Here

Examples of org.hbasene.index.create.IndexConfiguration

    Configuration conf = new HBaseConfiguration();
    if (iconfFile != null) {
      // set index configuration content from a file
      String content = readContent(iconfFile);
      IndexConfiguration iconf = new IndexConfiguration();
      // purely to validate, exception will be thrown if not valid
      iconf.addFromXML(content);
      conf.set("hbase.index.conf", content);
    }

    if (columnNames != null) {
      JobConf jobConf = createJob(conf, numMapTasks, numReduceTasks, indexDir,
View Full Code Here

Examples of org.hbasene.index.create.IndexConfiguration

  private IndexConfiguration indexConf;

  @Override
  public void configure(JobConf job) {
    super.configure(job);
    indexConf = new IndexConfiguration();
    String content = job.get("hbase.index.conf");
    if (content != null) {
      indexConf.addFromXML(content);
    }
    if (LOG.isDebugEnabled()) {
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.