@Override public long getLong(final Object key) { return stringMap.getLong(key); }
@Override public synchronized long getLong(Object s) { return stringMap.getLong(s); }
public synchronized long getLong( Object s ) { return stringMap.getLong( s ); }
public synchronized long getLong( Object s ) { return stringMap.getLong( s ); }
public int resolve( final CharSequence virtualDocumentSpec ) { try { URI virtualURI = URI.create( virtualDocumentSpec.toString() ).normalize(); if ( ! virtualURI.isAbsolute() ) { if ( documentURI == null ) return -1; virtualURI = documentURI.resolve( virtualURI ); } return (int)url2DocumentPointer.getLong( virtualURI.toString() ); } catch ( Exception e ) { return -1; } }
public int resolve( final CharSequence virtualDocumentSpec ) { try { URI virtualURI = URI.create( virtualDocumentSpec.toString() ).normalize(); if ( ! virtualURI.isAbsolute() ) { if ( documentURI == null ) return -1; virtualURI = documentURI.resolve( virtualURI ); } // TODO discard opaque? return (int)url2DocumentPointer.getLong( virtualURI.toString() ); } catch ( Exception e ) { return -1; } }
public int localIndex( final CharSequence term ) { for( int i = 0; i < termMap.length; i++ ) if ( ( termFilter == null || termFilter[ i ].contains( term ) ) && termMap[ i ].getLong( term ) != -1 ) return i; return -1; }
public int localIndex( final CharSequence term ) { for( int i = 0; i < termMap.length; i++ ) if ( ( termFilter == null || termFilter[ i ].contains( term ) ) && termMap[ i ].getLong( term ) != -1 ) return i; return -1; }
public IndexIterator documents( final CharSequence term ) throws IOException { if ( closed ) throw new IllegalStateException( "This " + getClass().getSimpleName() + " has been closed" ); if ( index.termMap != null ) { final int termIndex = (int)index.termMap.getLong( term ); if ( termIndex == -1 ) return index.getEmptyIndexIterator( term, termIndex ); return documents( term, termIndex ); } throw new UnsupportedOperationException( "Index " + index + " has no term map" ); } @Override
public IndexIterator documents( final CharSequence term ) throws IOException { if ( closed ) throw new IllegalStateException( "This " + getClass().getSimpleName() + " has been closed" ); if ( index.termMap != null ) { final int termIndex = (int)index.termMap.getLong( term ); if ( termIndex == -1 ) return index.getEmptyIndexIterator( term, termIndex ); return documents( term, termIndex ); } throw new UnsupportedOperationException( "Index " + index + " has no term map" ); } @Override
public IndexIterator documents( final CharSequence term ) throws IOException { if ( closed ) throw new IllegalStateException( "This " + getClass().getSimpleName() + " has been closed" ); if ( index.termMap != null ) { final int termIndex = (int)index.termMap.getLong( term ); if ( termIndex == -1 ) return index.getEmptyIndexIterator( term, termIndex ); return documents( term, termIndex ); } throw new UnsupportedOperationException( "Index " + index + " has no term map" ); }
public IndexIterator documents( final CharSequence term ) throws IOException { if ( closed ) throw new IllegalStateException( "This " + getClass().getSimpleName() + " has been closed" ); if ( index.termMap != null ) { final int termIndex = (int)index.termMap.getLong( term ); if ( termIndex == -1 ) return index.getEmptyIndexIterator( term, termIndex ); return documents( term, termIndex ); } throw new UnsupportedOperationException( "Index " + index + " has no term map" ); } @Override
public IndexIterator documents( final CharSequence term ) throws IOException { if ( closed ) throw new IllegalStateException( "This " + getClass().getSimpleName() + " has been closed" ); if ( index.termMap != null ) { final int termIndex = (int)index.termMap.getLong( term ); if ( termIndex == -1 ) return index.getEmptyIndexIterator( term, termIndex ); return documents( term, termIndex ); } throw new UnsupportedOperationException( "Index " + index + " has no term map" ); } @Override
public IndexIterator documents( final CharSequence term ) throws IOException { if ( closed ) throw new IllegalStateException( "This " + getClass().getSimpleName() + " has been closed" ); if ( index.termMap != null ) { final int termIndex = (int)index.termMap.getLong( term ); if ( termIndex == -1 ) return index.getEmptyIndexIterator( term, termIndex ); return documents( term, termIndex ); } throw new UnsupportedOperationException( "Index " + index + " has no term map" ); } @Override
public IndexIterator documents( final CharSequence term ) throws IOException { if ( closed ) throw new IllegalStateException( "This " + getClass().getSimpleName() + " has been closed" ); if ( index.termMap != null ) { final int termIndex = (int)index.termMap.getLong( term ); if ( termIndex == -1 ) return index.getEmptyIndexIterator( term, termIndex ); return documents( term, termIndex ); } throw new UnsupportedOperationException( "Index " + index + " has no term map" ); } @Override
@Override public IndexIterator documents( final CharSequence term ) throws IOException { if ( closed ) throw new IllegalStateException( "This " + getClass().getSimpleName() + " has been closed" ); if ( index.termMap != null ) { final int termIndex = (int)index.termMap.getLong( term ); if ( termIndex == -1 ) return index.getEmptyIndexIterator( term, termIndex ); return documents( term, termIndex ); } throw new UnsupportedOperationException( "Index " + index + " has no term map" ); }
outputStream.writeLong( termMap.getLong( s.readSelfDelimUTF8( (InputStream)inputStream ) ) ); outputStream.flush(); break;
outputStream.writeLong( termMap.getLong( s.readSelfDelimUTF8( (InputStream)inputStream ) ) ); outputStream.flush(); break;
public static void main( final String[] arg ) throws JSAPException, IOException, ConfigurationException, SecurityException, URISyntaxException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { final SimpleJSAP jsap = new SimpleJSAP( SubsetLexicalStrategy.class.getName(), "Builds a subset-based lexical partitioning strategy reading an UTF-8 encoded term list from standard input.", new Parameter[] { new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the index." ), new UnflaggedOption( "strategy", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename for the strategy." ) }); JSAPResult jsapResult = jsap.parse( arg ); if ( jsap.messagePrinted() ) return; final Index index = Index.getInstance( jsapResult.getString( "basename" ) ); @SuppressWarnings("resource") final FastBufferedReader reader = new FastBufferedReader( new InputStreamReader( System.in, "UTF-8" ) ); final MutableString s = new MutableString(); final IntOpenHashSet subset = new IntOpenHashSet(); while( reader.readLine( s ) != null ) { final int t = (int)index.termMap.getLong( s ); if ( t == -1 ) throw new IllegalArgumentException( "Unknown term " + s ); subset.add( t ); } reader.close(); BinIO.storeObject( new SubsetLexicalStrategy( subset ), jsapResult.getString( "strategy" ) ); }
if ( subset ) { term.replace( termIterator.next() ); if ( ( u = (int)aligneeIndex.termMap.getLong( term ) ) == -1 ) LOGGER.warn( "Term " + term + " is not part of the index to be aligned" ); termFile.println( term );