Package it.unimi.dsi.mg4j.tool

Source Code of it.unimi.dsi.mg4j.tool.ScanTest

package it.unimi.dsi.mg4j.tool;

import it.unimi.dsi.mg4j.index.Index;
import it.unimi.dsi.mg4j.index.IndexIterator;
import it.unimi.dsi.mg4j.tool.IndexBuilder;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;

import junit.framework.TestCase;

import org.apache.commons.configuration.ConfigurationException;

import it.unimi.dsi.mg4j.document.StringArrayDocumentCollection;

public class ScanTest extends TestCase {

  public void testEverywhereTerms() throws IOException, ConfigurationException, SecurityException, URISyntaxException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
   
    String basename = File.createTempFile( getClass().getSimpleName(), "everywhereTerms" ).getCanonicalPath();
    new IndexBuilder( basename, new StringArrayDocumentCollection( "a a" ) ).keepBatches( true ).run();
    IndexIterator indexIterator = Index.getInstance( basename + "-text@0" ).documents( 0 );
    indexIterator.next();
    assertEquals( 2, indexIterator.count() );
    int[] position = new int[ 2 ];
    indexIterator.positions( position );
    assertEquals( 0, position[ 0 ] );
    assertEquals( 1, position[ 1 ] );
  }


}
TOP

Related Classes of it.unimi.dsi.mg4j.tool.ScanTest

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.