Skip to content

Commit

Permalink
Merge pull request #12 from MoveCloudROY/dev_roy1994
Browse files Browse the repository at this point in the history
fix(backends): create the static domain to avoid Chrome Not Allowed t…
  • Loading branch information
MoveCloudROY authored May 27, 2023
2 parents e136e5b + 3493601 commit c495bd0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.24)
project(OurSearchEngine)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down
37 changes: 19 additions & 18 deletions assets/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
"https": false
}
],
"threads_num": 4,
"document_root": "/home/roy1994/Code/Project/OurSearchEngine/assets/material",
"file_types": [
"gif",
"png",
"jpg",
"js",
"css",
"html",
"ico",
"swf",
"xap",
"apk",
"cur",
"xml",
"htm",
"txt"
]
"app": {
"document_root": "../assets/material",
"file_types": [
"gif",
"png",
"jpg",
"js",
"css",
"html",
"ico",
"swf",
"xap",
"apk",
"cur",
"xml",
"htm",
"txt"
]
}
}
2 changes: 1 addition & 1 deletion src/preprocessing/src/LibraryBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void LibraryBuilder::scan_directory() {
for (const auto &entry : fs::directory_iterator(current_path)) {
bar.tick();
if (fs::is_regular_file(entry) && entry.path().extension() == ".txt") {
file_path_list.push_back(std::filesystem::canonical(entry.path()).string());
file_path_list.push_back(entry.path().string());
} else if (fs::is_directory(entry)) {
path_stack.push(entry.path());
}
Expand Down
10 changes: 7 additions & 3 deletions src/query/src/Queryer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <json/value.h>
#include <fstream>
#include <string>

#include <filesystem>
#include "XMLParser.hpp"
#include "Datatype.h"
#include "SearchResultBuilder.h"
Expand Down Expand Up @@ -109,8 +109,12 @@ std::pair<std::vector<std::unique_ptr<SearchResultItem>>, uint64_t> Queryer::cre
info.title = xmlParser.parser("Title");
info.text = xmlParser.parser("Content");
info.desc = info.text.substr(0, std::min(static_cast<uint64_t>(info.text.size()), 256ul)); //描述暂时用标题替代
std::map<std::string, double> correlation; //相关性暂时设为空
std::unique_ptr<SearchResultItem> item = std::make_unique<SearchResultItem>(scores[i].second, "file://" + xmlParser.parser("Url"), info, correlation, 0);
std::map<std::string, double> correlation;
//相关性暂时设为空
auto url = std::filesystem::relative(xmlParser.parser("Url"), "../assets/material");

std::unique_ptr<SearchResultItem>
item = std::make_unique<SearchResultItem>(scores[i].second, "http://localhost:7777/" + url.string(), info, correlation, 0);

ret.push_back(std::move(item));
}
Expand Down

0 comments on commit c495bd0

Please sign in to comment.