00001 #include "index_searching.hpp"
00002 #include "invertedindex.hpp"
00003
00004 namespace aitools {
00005 namespace invertedindex {
00006
00007 void search_index(const bfs::path& index_dir)
00008 {
00009
00010
00011 Configuration config;
00012 config.set_index_directory(index_dir.string());
00013
00014
00015
00016
00017 IndexSearcher<IntFloat> searcher;
00018
00019 try
00020 {
00021
00022
00023 searcher.init(config);
00024
00025
00026
00027
00028
00029
00030 Postlist<IntFloat> postlist(searcher.search("2206"));
00031 postlist.info(std::cout);
00032
00033
00034
00035
00036
00037 IntFloat value;
00038 while (postlist.next(value))
00039 {
00040 std::cout << value << std::endl;
00041 }
00042 }
00043 catch (const std::exception& error)
00044 {
00045 Logging::error(std::string(error.what()));
00046 }
00047 }
00048
00049 }
00050 }