Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds four new computer science textbooks to the book database and introduces a new loading method in BookLoader specifically designed for the indexer process.
Changes:
- Added four technical books: Computer Organization and Architecture, Introduction to Computer Theory, Assembly Language Programming, and Database System Concepts
- Introduced
loadBooksFromSource()method in BookLoader to read directly from the file system for indexing - Updated IndexerMain to use the new loading method
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| src/main/resources/data/book.json | Added four new book entries (IDs 208-211) covering computer organization, automata theory, assembly programming, and databases |
| src/main/java/storage/BookLoader.java | Added new loadBooksFromSource() method that reads directly from file system instead of resources, specifically for the indexer |
| src/main/java/core/IndexerMain.java | Updated to use loadBooksFromSource() method and added unused IOException import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "Assembly", | ||
| "I/O Systems" | ||
| ], | ||
| "rating": "4.1", |
There was a problem hiding this comment.
The rating field should be a numeric value, not a string. The Book domain model expects a float type for the rating field. Change "4.1" to 4.1 (without quotes) to match the data type used in most other book entries.
| "rating": "4.1", | |
| "rating": 4.1, |
| "Computation", | ||
| "Computer Science" | ||
| ], | ||
| "rating": "4.3", |
There was a problem hiding this comment.
The rating field should be a numeric value, not a string. The Book domain model expects a float type for the rating field. Change "4.3" to 4.3 (without quotes) to match the data type used in most other book entries.
| "rating": "4.3", | |
| "rating": 4.3, |
| "Machine Code", | ||
| "Low-Level Programming" | ||
| ], | ||
| "rating": "4.5", |
There was a problem hiding this comment.
The rating field should be a numeric value, not a string. The Book domain model expects a float type for the rating field. Change "4.5" to 4.5 (without quotes) to match the data type used in most other book entries.
| "rating": "4.5", | |
| "rating": 4.5, |
| "Query Processing", | ||
| "Transaction Management" | ||
| ], | ||
| "rating": "4.5", |
There was a problem hiding this comment.
The rating field should be a numeric value, not a string. The Book domain model expects a float type for the rating field. Change "4.5" to 4.5 (without quotes) to match the data type used in most other book entries.
| "rating": "4.5", | |
| "rating": 4.5, |
| import utils.TfIdfCalculator; | ||
|
|
||
| import java.io.File; | ||
| import java.io.IOException; |
There was a problem hiding this comment.
This import is unused and should be removed. The code catches generic Exception rather than IOException specifically.
| try { | ||
| // Reads directly from the project folder, ignoring AppData | ||
| return mapper.readValue(new File("src/main/resources" + path), new TypeReference<List<Book>>() {}); |
There was a problem hiding this comment.
The hardcoded path "src/main/resources" may cause issues when running from a JAR or in different environments. Consider making this configurable or using a more robust resource loading approach that works consistently across different runtime contexts.
| try { | |
| // Reads directly from the project folder, ignoring AppData | |
| return mapper.readValue(new File("src/main/resources" + path), new TypeReference<List<Book>>() {}); | |
| // Load from classpath so this works both in development and from a packaged JAR | |
| try (InputStream inputStream = getClass().getResourceAsStream(path)) { | |
| if (inputStream == null) { | |
| // Resource not found on classpath | |
| return Collections.emptyList(); | |
| } | |
| return mapper.readValue(inputStream, new TypeReference<List<Book>>() {}); |
| "title": "Assembly Language Programming and Organization of the IBM PC", | ||
| "author": "Ytha Y. Yu, Charles Marut", | ||
| "description": "A comprehensive tutorial-style guide to assembly language programming on the IBM PC, covering microcomputer systems, representation of numbers and characters, instruction sets, memory and I/O organization, BIOS/DOS interrupts, graphics and keyboard programming, and advanced topics with practical examples and exercises.", | ||
| "progLang": "English", |
There was a problem hiding this comment.
The progLang field should be "Assembly" rather than "English" since this book is specifically about assembly language programming for the IBM PC. This would be consistent with book 208 which also uses "Assembly" for assembly-related content.
| "progLang": "English", | |
| "progLang": "Assembly", |
No description provided.