src/it/flosslab/dao/indexer/IndexerDAO.java
public void index(IndexWriter writer, File file)
			throws ContentParserException {

		logger.debug(file.getAbsolutePath());

		if (contentParser == null)
			return;

		// iterate over folders and files
		if (file.canRead()) {
			if (file.isDirectory()) {
				String[] files = file.list();
				if (files != null) {
					for (int i = 0; i < files.length; i++) {
						try {
							index(writer, new File(file, files[i]));
						} catch (Exception e) {
							logger.error(e);
						}
					}
				}
			} else {
				logger.debug("Indexing " + file);
				try {
					Document doc = null;
					// parse the document
					synchronized (contentParserAccess) {
						doc = contentParser.getDocument(file);
					}

					// put it into Lucene
					if (doc != null) {
						writer.addDocument(doc);
					} else {
						logger.error("Cannot handle "
								+ file.getAbsolutePath() + "; skipping");
					}
				} catch (IOException e) {
					logger.error("Cannot index " + file.getAbsolutePath()
							+ "; skipping (" + e.getMessage() + ")");
				}
			}
		}
	}
/**
	 * Index the given file and use the given writer to store it.
	 * 
	 * @param writer
	 * @param file
	 * @throws ContentParserException
	 */
Index the given file and use the given writer to store it.

@param writer
@param file
@throws ContentParserException
Index the given file and use the given writer to store it . @param writer @param file @throws ContentParserException
public void index(IndexWriter writer, File file)
			throws ContentParserException {
		logger.debug(file.getAbsolutePath());
		if (contentParser == null)
			return;
		if (file.canRead()) {
			if (file.isDirectory()) {
				String[] files = file.list();
				if (files != null) {
					for (int i = 0; i < files.length; i++) {
						try {
							index(writer, new File(file, files[i]));
						} catch (Exception e) {
							logger.error(e);
						}
					}
				}
			} else {
				logger.debug("Indexing " + file);
				try {
					Document doc = null;
					synchronized (contentParserAccess) {
						doc = contentParser.getDocument(file);
					}
					if (doc != null) {
						writer.addDocument(doc);
					} else {
						logger.error("Cannot handle "
								+ file.getAbsolutePath() + "; skipping");
					}
				} catch (IOException e) {
					logger.error("Cannot index " + file.getAbsolutePath()
							+ "; skipping (" + e.getMessage() + ")");
				}
			}
		}
	}
public void index ( IndexWriter writer , File file ) throws ContentParserException { logger . debug ( file . getAbsolutePath ( ) ) ; if ( contentParser == null ) return ; if ( file . canRead ( ) ) { if ( file . isDirectory ( ) ) { String [ ] files = file . list ( ) ; if ( files != null ) { for ( int i = 0 ; i < files . length ; i ++ ) { try { index ( writer , new File ( file , files [ i ] ) ) ; } catch ( Exception e ) { logger . error ( e ) ; } } } } else { logger . debug ( "Indexing " + file ) ; try { Document doc = null ; synchronized ( contentParserAccess ) { doc = contentParser . getDocument ( file ) ; } if ( doc != null ) { writer . addDocument ( doc ) ; } else { logger . error ( "Cannot handle " + file . getAbsolutePath ( ) + "; skipping" ) ; } } catch ( IOException e ) { logger . error ( "Cannot index " + file . getAbsolutePath ( ) + "; skipping (" + e . getMessage ( ) + ")" ) ; } } } }
Index the given file and use the given writer to store it.
Index the given file and use the given writer to store it .
// iterate over folders and files // parse the document // put it into Lucene