/** * Loads index(s) from disk. * */ @SuppressWarnings("deprecation") protected void loadIndex() { indexref = IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX); }
/** * Loads index(s) from disk. * */ @SuppressWarnings("deprecation") protected void loadIndex() { indexref = IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX); }
/** * Create a querying manager. This method should be overriden if * another matching model is required. */ @SuppressWarnings("deprecation") protected void createManager() { queryingManager = ManagerFactory.from(IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX)); }
@VisibleForTesting @SuppressWarnings("deprecation") public static void reinit() { indexRef = IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX); m = ManagerFactory.from(indexRef); }
@VisibleForTesting @SuppressWarnings("deprecation") public static void reinit() { indexRef = IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX); m = ManagerFactory.from(indexRef); }
/** * Create a querying manager. This method should be overriden if * another matching model is required. */ @SuppressWarnings("deprecation") protected void createManager() { queryingManager = ManagerFactory.from(IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX)); }
protected IndexRef getUnderlyingRef(IndexRef ref) { String underlyinglocation = ref.toString().replaceFirst(PREFIX, ""); return IndexRef.of(underlyinglocation); }
protected IndexRef getUnderlyingRef(IndexRef ref) { String underlyinglocation = ref.toString().replaceFirst(PREFIX, ""); return IndexRef.of(underlyinglocation); }
public static IndexRef makeConcurrent(IndexRef ref) { if (IndexFactory.isLoaded(ref)) return new DirectIndexRef( ConcurrentIndexUtils.makeConcurrentForRetrieval( ((DirectIndexRef)ref).underlyingIndex )){ private static final long serialVersionUID = 1L; @Override public String toString() { return PREFIX + super.toString(); } }; return IndexRef.of(PREFIX + ref.toString()); }
public static IndexRef makeConcurrent(IndexRef ref) { if (IndexFactory.isLoaded(ref)) return new DirectIndexRef( ConcurrentIndexUtils.makeConcurrentForRetrieval( ((DirectIndexRef)ref).underlyingIndex )){ private static final long serialVersionUID = 1L; @Override public String toString() { return PREFIX + super.toString(); } }; return IndexRef.of(PREFIX + ref.toString()); }
@SuppressWarnings("deprecation") @Override public int run(String[] args) { Index.setIndexLoadingProfileAsRetrieval(false); Index i = IndexFactory.of(IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX)); System.out.println("Collection statistics:"); System.out.println("number of indexed documents: " + i.getCollectionStatistics().getNumberOfDocuments()); System.out.println("size of vocabulary: " + i.getCollectionStatistics().getNumberOfUniqueTerms()); System.out.println("number of tokens: " + i.getCollectionStatistics().getNumberOfTokens()); System.out.println("number of pointers: " + i.getCollectionStatistics().getNumberOfPointers()); try { i.close(); } catch (IOException e) {} return 0; }
@SuppressWarnings("deprecation") @Override public int run(String[] args) { Index.setIndexLoadingProfileAsRetrieval(false); Index i = IndexFactory.of(IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX)); System.out.println("Collection statistics:"); System.out.println("number of indexed documents: " + i.getCollectionStatistics().getNumberOfDocuments()); System.out.println("size of vocabulary: " + i.getCollectionStatistics().getNumberOfUniqueTerms()); System.out.println("number of tokens: " + i.getCollectionStatistics().getNumberOfTokens()); System.out.println("number of pointers: " + i.getCollectionStatistics().getNumberOfPointers()); try { i.close(); } catch (IOException e) {} return 0; }
@Override public int run(CommandLine line) throws Exception { @SuppressWarnings("deprecation") IndexRef ref = IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX); Index index = IndexFactory.of(ref); if (index == null)
@Override public int run(CommandLine line) throws Exception { @SuppressWarnings("deprecation") IndexRef ref = IndexRef.of(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX); Index index = IndexFactory.of(ref); if (index == null)
TRECQuerying tq = new TRECQuerying(IndexRef.of(uri)); tq.setTopicsParser(SingleLineTRECQuery.class.getName()); ApplicationSetup.setProperty("trec.topics", topicsFile);
@Test public void itWorksBlocksFeatures() throws Exception { Index index = IndexTestUtils.makeIndexBlocks(new String[]{"doc1"}, new String[]{"token1 token2 token3"}); // String path = ((IndexOnDisk)index).getPath(); // String prefix = ((IndexOnDisk)index).getPrefix(); int port = new Random().nextInt(65536-1024)+1024; System.err.println("itWorksBlocksFeatures: Index is " + index.getIndexRef().toString()); String uri = "http://127.0.0.1:"+port+"/"; HttpServer server = makeServer(index, uri); SearchResource.reinit(); index.close(); ApplicationSetup.setProperty("fat.featured.scoring.matching.features", "WMODEL:BM25;WMODEL:PL2;DSM:"+DFRDependenceScoreModifier.class.getSimpleName()); Manager restManager = ManagerFactory.from(IndexRef.of(uri)); assertNotNull(restManager); SearchRequest srq = restManager.newSearchRequestFromQuery("\"token1 token2\""); srq.setControl(SearchRequest.CONTROL_MATCHING, FatFeaturedScoringMatching.class.getName() + "," + FatFull.class.getName() ); restManager.runSearchRequest(srq); assertEquals(1, srq.getResults().size()); assertEquals("doc1", srq.getResults().get(0).getMetadata("docno")); server.shutdown().get(); //IndexUtil.deleteIndex(path, prefix); }
@Test public void itWorks() throws Exception { Index index = IndexTestUtils.makeIndex(new String[]{"doc1"}, new String[]{"token1 token2 token3"}); // String path = ((IndexOnDisk)index).getPath(); // String prefix = ((IndexOnDisk)index).getPrefix(); int port = new Random().nextInt(65536-1024)+1024; String uri = "http://127.0.0.1:"+port+"/"; System.err.println("itWorks: Index is " + index.getIndexRef().toString()); HttpServer server = makeServer(index, uri); SearchResource.reinit(); index.close(); Manager restManager = ManagerFactory.from(IndexRef.of(uri)); assertNotNull(restManager); SearchRequest srq = restManager.newSearchRequestFromQuery("token1"); restManager.runSearchRequest(srq); assertEquals(1, srq.getResults().size()); assertEquals("doc1", srq.getResults().get(0).getMetadata("docno")); server.shutdown().get(); //IndexUtil.deleteIndex(path, prefix); }