text stringlengths 74 309k |
|---|
Unzip the "stackoverflow.zip" and place stackoverflow.jsonl in this folder |
{"title":"How to undo 'git add' before commit?","tags":["git","version-control","git-stage"],"question_text":"I mistakenly added files using the command:\n`git add myfile.txt`\nI have not yet run\n`git commit`\n. Is there a way to undo this, so these files won't be included in the commit?","answer_text":"You can undo\n... |
{"title":"Regular expression to match line that doesn't contain a word?","tags":["regex","regex-negation"],"question_text":"I know it's possible to match a word and then reverse the matches using other tools (e.g.\n`grep -v`\n). However, I'd like to know if it's possible to match lines that\ndon't\ncontain a specific w... |
{"title":"How to check if a string contains a specific word in PHP?","tags":["php","string"],"question_text":"Consider:\n`$a = 'How are you?';\nif ($a contains 'are')\n echo 'true';`\nSuppose I have the code above, what is the correct way to write the statement\n`if ($a contains 'are')`\n?","answer_text":"You can use t... |
{"title":"Is Java \"pass-by-reference\" or \"pass-by-value\"?","tags":["java","methods","parameter-passing","pass-by-reference","pass-by-value"],"question_text":"I always thought Java was\npass-by-reference\n; however I've seen a couple of blog posts (for example,\nthis blog\n) that claim it's not. I don't think I unde... |
{"title":"How to find all files containing specific text on Linux?","tags":["linux","text","grep","directory","find"],"question_text":"I'm trying to find a way to scan my entire Linux system for all files containing a specific string of text. Just to clarify, I'm looking for text within the file, not in the file name.\... |
{"title":"Make an existing Git branch track a remote branch?","tags":["git","branch","git-branch"],"question_text":"I know how to make a new branch that tracks remote branches, but\nhow do I make an existing branch track a remote branch?\nI know I can just edit the\n`.git\/config`\nfile, but it seems there should be an... |
{"title":"What is your most productive shortcut with Vim?","tags":["vim","productivity","vi"],"question_text":"I've heard a lot about\nVim\n, both pros and cons.\nIt really seems you should be (as a developer) faster with Vim than with any other editor.\nI'm using Vim to do some basic stuff and I'm at best 10 times\nle... |
{"title":"Why does Google prepend while(1); to their JSON responses?","tags":["javascript","ajax","json"],"question_text":"Why does Google prepend\n`while(1);`\nto their (private) JSON responses?\nFor example, here's a response while turning a calendar on and off in\nGoogle Calendar\n:\n`while(1);[['u',[['smsSentFlag',... |
{"title":"How to get the current branch name in Git?","tags":["git"],"question_text":"I'm from a Subversion background and, when I had a branch, I knew what I was working on with \"These working files point to this branch\".\nBut with Git I'm not sure when I am editing a file in NetBeans or Notepad++, whether it's tied... |
{"title":"Set a default parameter value for a JavaScript function","tags":["javascript","function","arguments","default"],"question_text":"I would like a JavaScript function to have optional arguments which I set a default on, which gets used if the value isn't defined. In Ruby you can do it like this:\n`def read_file(... |
{"title":"Loop through an array in JavaScript","tags":["javascript","arrays","for-loop"],"question_text":"In Java you can use a\n`for`\nloop to traverse objects in an array as follows:\n`String[] myStringArray = {\"Hello\", \"World\"};\nfor (String s : myStringArray)\n{\n \/\/ Do something\n}`\nCan you do the same in J... |
{"title":"How can I determine the URL that a local Git repository was originally cloned from?","tags":["git","github","git-remote"],"question_text":"I pulled a project from GitHub a few days ago. I've since discovered that there are several forks on GitHub, and I neglected to note which one I took originally. How can I... |
{"title":"How do I empty an array in JavaScript?","tags":["javascript","arrays"],"question_text":"Is there a way to empty an array and if so possibly with\n`.remove()`\n?\nFor instance,\n`A = [1,2,3,4];`\nHow can I empty that?","answer_text":"Ways to clear an existing array\n`A`\n:\nMethod 1\n(this was my original answ... |
{"title":"Using java.net.URLConnection to fire and handle HTTP requests","tags":["java","http","httprequest","httpurlconnection","urlconnection"],"question_text":"Use of\n`java.net.URLConnection`\nis asked about pretty often here, and the\nOracle tutorial\nis\ntoo\nconcise about it.\nThat tutorial basically only shows ... |
{"title":"Checking if a key exists in a JavaScript object?","tags":["javascript","arrays","object"],"question_text":"How do I check if a particular key exists in a JavaScript object or array?\nIf a key doesn't exist, and I try to access it, will it return false? Or throw an error?","answer_text":"Checking for undefined... |
{"title":"Proper use of the IDisposable interface","tags":["c#",".net","garbage-collection","idisposable"],"question_text":"I know from reading\nthe MSDN documentation\nthat the \"primary\" use of the IDisposable interface is to clean up unmanaged resources.\nTo me, \"unmanaged\" means things like database connections,... |
{"title":"How do I give text or an image a transparent background using CSS?","tags":["html","css","opacity"],"question_text":"Is it possible, using CSS only, to make the\n`background`\nof an element semi-transparent but have the content (text & images) of the element opaque?\nI'd like to accomplish this without having... |
{"title":"When should static_cast, dynamic_cast, const_cast and reinterpret_cast be used?","tags":["c++","pointers","casting","c++-faq"],"question_text":"What are the proper uses of:\n`static_cast`\n`dynamic_cast`\n`const_cast`\n`reinterpret_cast`\nC-style cast\n`(type)value`\nFunction-style cast\n`type(value)`\nHow do... |
{"title":"Is there a standard function to check for null, undefined, or blank variables in JavaScript?","tags":["javascript",null,"undefined"],"question_text":"Is there a universal JavaScript function that checks that a variable has a value and ensures that it's not\n`undefined`\nor\n`null`\n? I've got this code, but I... |
{"title":"How do you disable browser Autocomplete on web form field \/ input tag?","tags":["html","autocomplete"],"question_text":"How do you disable\n`autocomplete`\nin the major browsers for a specific\n`input`\n(or\n`form field`\n)?","answer_text":"Firefox 30 ignores\n`autocomplete=\"off\"`\nfor passwords, opting to... |
{"title":"What is attr_accessor in Ruby?","tags":["ruby"],"question_text":"I am having a hard time understanding\n`attr_accessor`\nin Ruby. Can someone explain this to me? I have done tons of Google searches. I just can't understand it fully.","answer_text":"Let's say you have a class\n`Person`\n.\n`class Person\nend\n... |
{"title":"When are you supposed to use escape instead of encodeURI \/ encodeURIComponent?","tags":["javascript","encoding","query-string"],"question_text":"When encoding a query string to be sent to a web server - when do you use\n`escape()`\nand when do you use\n`encodeURI()`\nor\n`encodeURIComponent()`\n:\nUse escape... |
{"title":"How to replace master branch in git, entirely, from another branch?","tags":["git","merge","git-branch"],"question_text":"Possible Duplicate:\nChange the current branch to master in git\nI have two branches in my git repo:\nmaster\nseotweaks (created originally from master)\nI created\n`seotweaks`\nwith the i... |
{"title":"What are the nuances of scope prototypal \/ prototypical inheritance in AngularJS?","tags":["javascript","angularjs","inheritance","prototype","prototypal-inheritance"],"question_text":"The\nAPI Reference Scope page\nsays:\nA scope\ncan\ninherit from a parent scope.\nThe\nDeveloper Guide Scope page\nsays:\nA ... |
{"title":"How to count all the lines of code in a directory recursively?","tags":["bash","shell"],"question_text":"We've got a PHP application and want to count all the lines of code under a specific directory and its subdirectories. We don't need to ignore comments, as we're just trying to get a rough idea.\n`wc -l *.... |
{"title":"How to exit the VIM editor?","tags":["vim","vi"],"question_text":"I'm stuck and cannot escape. It says:\n`\"type :quit<Enter> to quit VIM\"`\nbut when I type that it simply appears in the object body.","answer_text":"Hit the\nEsc\nkey; that goes into command mode. Then you can type\n`:q`\nto quit (short for\n... |
{"title":"Vertically align text next to an image?","tags":["css","vertical-alignment"],"question_text":"Why won't\n`vertical-align: middle`\nwork? And yet,\n`vertical-align: top`\ndoes\nwork.\n`<div>\n <img style=\"width:30px;height:30px\">\n <span style=\"vertical-align:middle\">Doesn't work.<\/span>\n<\/div>`","answe... |
{"title":"How to determine whether my calculation of pi is accurate?","tags":["algorithm","math","language-agnostic","pi"],"question_text":"I was trying various methods to implement a program that gives the digits of pi sequentially. I tried the\nTaylor series\nmethod, but it proved to converge extremely slowly (when I... |
{"title":"How do I randomly select an item from a list using Python?","tags":["python","list","random"],"question_text":"Assume I have the following list:\n`foo = ['a', 'b', 'c', 'd', 'e']`\nWhat is the simplest way to retrieve an item at random from this list?","answer_text":"Use\n`random.choice`\n:\n`import random\nf... |
{"title":"Check if a program exists from a Bash script","tags":["bash","shell"],"question_text":"How would I validate that a program exists?\nWhich would then either return an error and exit or continue with the script?\nIt seems like it should be easy, but it's been stumping me.","answer_text":"Yes; avoid\n`which`\n. ... |
{"title":"How does Trello access the user's clipboard?","tags":["javascript","coffeescript","clipboard","trello"],"question_text":"When you hover over a card in\nTrello\nand press\nCtrl\n+\nC\n, the URL of this card is copied to the clipboard. How do they do this?\nAs far as I can tell, there is no Flash movie involved... |
{"title":"How to efficiently count the number of keys\/properties of an object in JavaScript?","tags":["javascript","performance","properties","count","key"],"question_text":"What's the fastest way to count the number of keys\/properties of an object? It it possible to do this without iterating over the object? i.e. wi... |
language: - en tags: - nlp - retrieval - rag - faiss - bm25 - semantic-search - stackoverflow - code-generation - information-retrieval size_categories: - 10M<n<100M pretty_name: StackFix Indexes (Pre-Built)
π StackFix Indexes (Pre-Built)
Pre-built FAISS and BM25 indexes for high-quality StackOverflow retrieval.
Designed for:
- RAG systems
- Agentic debugging
- Code retrieval
- LLM augmentation
- Semantic search pipelines
These indexes were generated using the top-scoring 1.1 million StackOverflow Q&A pairs and optimized for programming-related retrieval tasks.
π Dataset Statistics
| Metric | Value |
|---|---|
| Total Documents | 1,102,568 Q&A pairs |
| Selection Strategy | Highest-scored answer per question |
| Average StackOverflow Score | 3.31 |
| Embedding Model | BAAI/bge-base-en-v1.5 |
| Embedding Dimensions | 768 |
| Similarity Metric | Cosine Similarity |
| Vector Normalization | Enabled |
π·οΈ Top 10 Tags / Languages
| Tag | Question Count |
|---|---|
| javascript | 108,637 |
| java | 100,781 |
| c# | 90,035 |
| php | 87,354 |
| android | 74,596 |
| jquery | 70,002 |
| python | 57,082 |
| html | 53,261 |
| c++ | 43,040 |
| ios | 39,329 |
π§ Embedding Architecture
Dense Retrieval
- Model:
BAAI/bge-base-en-v1.5 - FAISS-based vector search
- Normalized embeddings for cosine similarity
Sparse Retrieval
- BM25 keyword index
- Optimized for hybrid retrieval workflows
Retrieval Text Construction
Questions, accepted/highest-scored answers, and code blocks were merged into a unified retrieval_text field during preprocessing.
This structure improves:
- semantic debugging retrieval
- code-aware search
- agentic reasoning pipelines
- long-context augmentation
π¦ Included Files
| File | Description |
|---|---|
faiss_index/ |
Pre-built FAISS vector index |
bm25_index.pkl |
Serialized BM25 retrieval index |
π₯ Usage
- Download the files from this repository.
- Place them inside:
./model_cache/
- Launch your application:
chainlit run app.py
The system will automatically detect and load the indexes.
π Source Dataset
The indexes were built using the public StackSample dataset hosted on Kaggle:
https://www.kaggle.com/datasets/stackoverflow/stacksample/data
The original data contains StackOverflow question-answer pairs and metadata.
βοΈ Licensing & Attribution
This repository distributes derived retrieval indexes and preprocessing artifacts under the Apache 2.0 license.
Original StackOverflow content and associated rights belong to their respective owners.
Please ensure appropriate attribution when redistributing derived works or generated datasets.
π Recommended Use Cases
- Retrieval-Augmented Generation (RAG)
- AI coding assistants
- StackOverflow semantic search
- Agentic debugging systems
- Code question answering
- Hybrid retrieval pipelines
β Not Recommended For
- Exact code formatting retrieval
- Production-grade syntax reconstruction
- Legal/compliance-sensitive archival applications
π Acknowledgements
- StackOverflow
- BAAI
- FAISS
- Hugging Face
- Downloads last month
- 30