{"id":22503154,"url":"https://github.com/afa-farkhod/csv-vector-search-java-api","last_synced_at":"2025-10-09T18:33:47.517Z","repository":{"id":173231157,"uuid":"631507095","full_name":"afa-farkhod/CSV-Vector-Search-Java-API","owner":"afa-farkhod","description":"CSV \u0026 Vector-Search Java API","archived":false,"fork":false,"pushed_at":"2023-07-02T00:48:59.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T18:33:11.517Z","etag":null,"topics":["csv-reader","java","vector-search"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afa-farkhod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-23T08:30:20.000Z","updated_at":"2023-07-01T06:12:13.000Z","dependencies_parsed_at":"2023-10-03T17:11:20.283Z","dependency_job_id":"a81af096-481b-41d7-a0ce-007cb3c6c427","html_url":"https://github.com/afa-farkhod/CSV-Vector-Search-Java-API","commit_stats":null,"previous_names":["af4092/csv-vector-search-java-api","afa-farkhod/csv-vector-search-java-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/afa-farkhod/CSV-Vector-Search-Java-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FCSV-Vector-Search-Java-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FCSV-Vector-Search-Java-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FCSV-Vector-Search-Java-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FCSV-Vector-Search-Java-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afa-farkhod","download_url":"https://codeload.github.com/afa-farkhod/CSV-Vector-Search-Java-API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FCSV-Vector-Search-Java-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001933,"owners_count":26083226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv-reader","java","vector-search"],"created_at":"2024-12-06T23:29:57.270Z","updated_at":"2025-10-09T18:33:47.499Z","avatar_url":"https://github.com/afa-farkhod.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java-CSV-API\n- CSV sample program is implemented inside the `CSV_Read_Sample` folder\n- The Java program that reads a `*.csv` file and displays its contents in a tabular format.\n\n## CSV (Comma Separated Values) sample Java api\n\n- Java program reads a `*.csv` file and prints its contents to the console. It utilizes Java's standard I/O classes to perform file operations and exception handling to handle potential errors.\n\n- Sample data: `testData.csv`\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/24220136/233832939-28349291-b299-4a38-9793-1ad6493b7222.png\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n- Java api reads the file then outputs the data \n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/24220136/233832923-b73f1e16-b667-4054-b638-a8bf38ec69bb.png\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n- `CSV_Read_Sample.java` explanation:\n\n  - The code declares a class named Test within the package org.example.\n\n  - The main method serves as the entry point of the program.\n\n  - The code defines a file path variable (file) that points to the location of the CSV file to be read.\n\n  - It initializes a BufferedReader object (reader) as null. This object will be used to read the file.\n\n  - Inside a try block, the code creates a BufferedReader by passing a FileReader object (initialized with the file path) to it. This establishes a connection to the file for reading.\n\n  - The code enters a loop that reads each line of the file using reader.readLine() until the end of the file is reached (i.e., the returned line is null).\n\n  - Within the loop, each line is split into an array of strings using a comma (,) as the delimiter. The resulting array is stored in the row variable.\n\n  - Another loop iterates over each element in the row array and prints it to the console using System.out.printf(). The %-20s formatting ensures left alignment and a minimum width of 20 characters for each printed value.\n\n  - After printing all values in a row, a newline character is printed using System.out.println() to move to the next line.\n\n  - If an exception occurs during file reading or printing, it is caught in the catch block, and the exception stack trace is printed to the console using e.printStackTrace().\n\n  - Finally, the finally block ensures that the BufferedReader object is properly closed using the close() method. If an exception occurs while closing the reader, a RuntimeException is thrown with the original exception as its cause.\n\n-------------------------------------\n\n# [Vector-Search](https://en.wikipedia.org/wiki/Vector_space_model)\n\n- Vector Search program is implemented in the following folder: `Vector_Search_Sample` \n- The Java program that allows the user to search for a keyword in a `*.csv file`. The program prompts the user to enter a keyword, reads the input, and then opens a CSV file specified by the file path. It reads the file line by line and checks if each line contains the keyword. If a match is found, it prints the row index and the entire line. Finally, it closes the file and handles any exceptions that may occur during the file reading process.\n- Overall, this code demonstrates a simple file handling operation in Java, where a *.csv file is read, and a keyword search is performed on its contents.\n\n## Vector Search Sample\n\n- Java code allows the user to search for a keyword within a CSV file. It utilizes Java's standard I/O classes, exception handling, and user input functionality to achieve this task.\n\n- Test Data is NationalUniversitiesRankings.csv\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/24220136/233833032-cb18b396-4553-4fe1-992f-4351bffe4dc8.png\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n- Java API reads the file then searchs for the particular keyword\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/24220136/233833045-80be041f-7e10-4871-a8a3-3b0f2d90d8ef.png\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n- `Vector Search` is implemented in the below lines (This loop is performing the vector search by comparing each element in the row to the keyword entered by the user. If a match is found, it prints the entire row where the keyword was found.):\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/24220136/233833117-86ba265a-cc00-4202-9967-cf9212e1635d.png\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n- `Vector_Search_Sample.java` code explanation:\n\n  - Code starts by importing necessary classes for file handling, exception handling, and user input.\n\n  - The code declares a class named Test within the package `org.example.`\n\n  - The main method serves as the entry point of the program.\n\n  - The code defines a file path variable (file) that points to the location of the CSV file to be read.\n\n  - It initializes a `BufferedReader` object (reader) as null. This object will be used to read the file.\n\n  - It declares a string variable (line) to store each line read from the file.\n\n  - It declares an integer variable (`rowIndex`) to keep track of the current row being read.\n\n  - It initializes a Scanner object (input) to receive user input from the console.\n\n  - The code prompts the user to enter a keyword to search within the CSV file using `System.out.print()`.\n\n  - It reads the user's input (keyword) using `input.nextLine()` and stores it in a string variable (keyword).\n\n  - Inside a try block, the code creates a `BufferedReader` by passing a `FileReader` object (initialized with the file path) to it. This establishes a connection to the file for reading.\n\n  - The code enters a loop that reads each line of the file using `reader.readLine()` until the end of the file is reached (i.e., the returned line is null).\n\n  - Within the loop, each line is split into an array of strings using a comma (,) as the delimiter. The resulting array is stored in the row variable.\n\n  - Another loop iterates over each element in the row array and checks if the current element contains the keyword entered by the user using `index.contains(keyword)`.\n\n  - If a match is found, the code prints the row index (`rowIndex`) and the entire line where the keyword was found using `System.out.println()`.\n\n  - After processing each line, the rowIndex is incremented.\n\n  - If an exception occurs during file reading, searching, or printing, it is caught in the catch block, and the exception stack trace is printed to the console using `e.printStackTrace()`.\n\n  - Finally, the finally block ensures that the BufferedReader object is properly closed using the close() method. If an exception occurs while closing the reader, a `RuntimeException` is thrown with the original exception as its cause.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafa-farkhod%2Fcsv-vector-search-java-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafa-farkhod%2Fcsv-vector-search-java-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafa-farkhod%2Fcsv-vector-search-java-api/lists"}