fpravica / grep4j

Automatically exported from code.google.com/p/grep4j
0 stars 0 forks source link

Iteration not working properly on GrepResults #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Search for a constant term like 'copyright' recursively in a directory
2. Try to iterate over the results like
    GrepResults allResults = //query  
    for (GrepResult result: allResults) {
    }

What is the expected output? 
If allResults.totalLines() = 15 then should iterate 15 times/

What do you see instead?
However the results are such that allResults.totalLines() = 15 but 
allResults.size() = 1 . Hence iteration happens only once all the entire 
results are considered to be one match.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by aditya.t...@gmail.com on 4 Aug 2014 at 7:51

GoogleCodeExporter commented 9 years ago
Each grepResult represents a profile, while totalLines represents the total 
lines found that match the expression passed.
So when you loop through all the GrepResults, you just loop through the 
profiles, not the lines.

Original comment by marcocast@gmail.com on 9 Aug 2014 at 12:24