Package org.apache.lenya.lucene

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


    /**
     * Get indexer from configuration
     */
    public static Indexer getIndexer(String luceneConfig) throws Exception {
        IndexConfiguration ie = new IndexConfiguration(luceneConfig);
        Indexer indexer = (Indexer) ie.getIndexerClass().newInstance();
        DOMUtil du = new DOMUtil();
        Document config = DocumentHelper.readDocument(new File(luceneConfig));
        indexer.configure(du.getElement(config.getDocumentElement(), new XPath("indexer")), luceneConfig);

        return indexer;
View Full Code Here

                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();

            String path = argv[0];

            Document config = DocumentHelper.readDocument(new File(path));
            Element indexerElement = DocumentHelper.getFirstChild(config.getDocumentElement(),
View Full Code Here

     * @throws IOException if an error occurs.
     */
    public static Indexer getIndexer(String luceneConfig) throws IOException {
        try {
            Indexer indexer;
            IndexConfiguration ie = new IndexConfiguration(luceneConfig);
            indexer = (Indexer) ie.getIndexerClass().newInstance();
            Document config = DocumentHelper.readDocument(new File(luceneConfig));
            Element indexerElement = DocumentHelper.getFirstChild(config.getDocumentElement(), null,
                    "indexer");
            indexer.configure(indexerElement, luceneConfig);
            return indexer;
View Full Code Here

     * </ol>
     * @param file The document
     * @throws IOException if an error occurs
     */
    public void indexDocument(File file) throws IOException {
        IndexConfiguration config = new IndexConfiguration(this.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

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

                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

    /**
     * Get indexer from configuration
     */
    public static Indexer getIndexer(String luceneConfig) throws Exception {
        IndexConfiguration ie = new IndexConfiguration(luceneConfig);
        Indexer indexer = (Indexer) ie.getIndexerClass().newInstance();
        DOMUtil du = new DOMUtil();
        Document config = DocumentHelper.readDocument(new File(luceneConfig));
        indexer.configure(du.getElement(config.getDocumentElement(), new XPath("indexer")), luceneConfig);

        return indexer;
View Full Code Here

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

            String debug = argv[1];

            if (debug.equalsIgnoreCase("false") || debug.equalsIgnoreCase("no")) {
                DebugConfiguration.setDebug(false);
            } else if (debug.equalsIgnoreCase("true") || debug.equalsIgnoreCase("yes")) {
                DebugConfiguration.setDebug(true);
            } else {
                System.err.println("ERROR: <debug> must be one of 'yes', 'true', 'no', or 'false'");
            }

            /*
                  for (int i = 0; i < argv.length; i++) {
                    if (argv[i].equals("-index")) {                  // parse -index option
                      index = argv[++i];
                    } else if (argv[i].equals("-create")) {          // parse -create option
                      create = true;
                    } else if (i != argv.length-1) {
                      System.err.println("Usage: " + usage);
                      return;
                    } else
                      root = new File(argv[i]);
                  }
             */
            Date start = new Date();

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

            DOMUtil du = new DOMUtil();
            Document config = new DOMParserFactory().getDocument(argv[0]);
            indexer.configure(du.getElement(config.getDocumentElement(), new XPath("indexer")), argv[0]);

View Full Code Here

            if(argv.length != 2){
                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;
            }
           
            String debug = argv[1];
            if (debug.equalsIgnoreCase("false") || debug.equalsIgnoreCase("no")) {
                DebugConfiguration.setDebug(false);
            }
            else if (debug.equalsIgnoreCase("false") || debug.equalsIgnoreCase("no")) {
                DebugConfiguration.setDebug(false);
            }
            else {
                System.err.println("ERROR: <debug> must be one of 'yes', 'true', 'no', or 'false'");
            }
           
/*
      for (int i = 0; i < argv.length; i++) {
        if (argv[i].equals("-index")) {      // parse -index option
          index = argv[++i];
        } else if (argv[i].equals("-create")) {    // parse -create option
          create = true;
        } else if (i != argv.length-1) {
          System.err.println("Usage: " + usage);
          return;
        } else
          root = new File(argv[i]);
      }
*/
           
            Date start = new Date();
           
            Indexer indexer = (Indexer) ie.getIndexerClass().newInstance();
           
            DOMUtil du = new DOMUtil();
            Document config = new DOMParserFactory().getDocument(argv[0]);
            indexer.configure(du.getElement(config.getDocumentElement(), new XPath("indexer")));
           
View Full Code Here

TOP

Related Classes of org.apache.lenya.lucene.IndexConfiguration

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.