// 論文データ（例）
const papers = [
    { id: 1, title: "論文1", content: "内容1" },
    { id: 2, title: "論文2", content: "内容2" },
    // 他の論文データ
];

const searchForm = document.getElementById("searchForm");
const searchInput = document.getElementById("searchInput");
const searchResults = document.getElementById("searchResults");

searchForm.addEventListener("submit", function(event) {
    event.preventDefault(); // フォームのデフォルトの送信を防ぐ
    const searchTerm = searchInput.value.toLowerCase(); // 検索キーワードを取得（小文字に変換）

    // 検索結果をフィルタリング
    const filteredPapers = papers.filter(function(paper) {
        return paper.title.toLowerCase().includes(searchTerm) || paper.content.toLowerCase().includes(searchTerm);
    });

    // 検索結果を表示
    displayResults(filteredPapers);
});

function displayResults(results) {
    // 検索結果を表示するためのHTMLを生成
    let html = "";
    results.forEach(function(result) {
        html += `<div>${result.title}</div>`; // タイトルを表示（他の情報も表示可能）
    });

    // 検索結果を表示
    searchResults.innerHTML = html;
}
