<commit_before>// PathVisio,
// a tool for data visualization and analysis using Biological Pathways
// Copyright 2006-2009 BiGCaT Bioinformatics
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package org.pathvisio.indexer;

import java.io.File;
import java.io.IOException;

import junit.framework.TestCase;

import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.bridgedb.rdb.GdbProvider;
import org.pathvisio.data.GdbManager;
import org.pathvisio.debug.Logger;
import org.pathvisio.preferences.PreferenceManager;

public class Search extends TestCase {
	static final File pathwayDir = new File("tools/lucene-indexer/test-data");
	static final File indexDir = new File("tools/lucene-indexer/test-index");

	public void testCreateIndex() {
		try {
			indexDir.mkdirs();
			//Start with fresh index
			for(File f : indexDir.listFiles()) {
				f.delete();
			}

			//Connect to any GDB in the preferences
			PreferenceManager.init();
			GdbManager gdbmgr = new GdbManager();
			gdbmgr.initPreferred();

			GdbProvider gdbs = new GdbProvider();
			gdbs.addGlobalGdb(gdbmgr.getCurrentGdb());

			GpmlIndexer indexer = new GpmlIndexer(indexDir, pathwayDir, gdbs);
			indexer.update();
			indexer.close();
		} catch(Exception e) {
			e.printStackTrace();
			fail("Exception during indexing: " + e.getMessage());
		}
	}<commit_msg>lucene-indexer test package - update after package renaming<commit_after>// PathVisio,
// a tool for data visualization and analysis using Biological Pathways
// Copyright 2006-2009 BiGCaT Bioinformatics
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package org.pathvisio.indexer;

import java.io.File;
import java.io.IOException;

import junit.framework.TestCase;

import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.bridgedb.rdb.GdbProvider;
import org.pathvisio.core.data.GdbManager;
import org.pathvisio.core.debug.Logger;
import org.pathvisio.core.preferences.PreferenceManager;

public class Search extends TestCase {
	static final File pathwayDir = new File("tools/lucene-indexer/test-data");
	static final File indexDir = new File("tools/lucene-indexer/test-index");

	public void testCreateIndex() {
		try {
			indexDir.mkdirs();
			//Start with fresh index
			for(File f : indexDir.listFiles()) {
				f.delete();
			}

			//Connect to any GDB in the preferences
			PreferenceManager.init();
			GdbManager gdbmgr = new GdbManager();
			gdbmgr.initPreferred();

			GdbProvider gdbs = new GdbProvider();
			gdbs.addGlobalGdb(gdbmgr.getCurrentGdb());

			GpmlIndexer indexer = new GpmlIndexer(indexDir, pathwayDir, gdbs);
			indexer.update();
			indexer.close();
		} catch(Exception e) {
			e.printStackTrace();
			fail("Exception during indexing: " + e.getMessage());
		}
	}
{'fraction_non_alphanumeric': 0.10731158605174353, 'fraction_numerical': 0.005399325084364455, 'mean_word_length': 4.299165673420739, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2401965', 'n_tokens_mistral': 1454, 'n_tokens_neox': 1329, 'n_words': 388}