Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eecs398-search
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vcday
eecs398-search
Commits
7c04b359
Commit
7c04b359
authored
7 years ago
by
Nicholas Yang
Browse files
Options
Downloads
Patches
Plain Diff
no need for words in our index /w a seek dictionary
parent
eeae8bec
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indexer/Indexer.cpp
+3
-3
3 additions, 3 deletions
indexer/Indexer.cpp
indexer/SeekFileTests.cpp
+2
-2
2 additions, 2 deletions
indexer/SeekFileTests.cpp
with
5 additions
and
5 deletions
indexer/Indexer.cpp
+
3
−
3
View file @
7c04b359
...
...
@@ -85,9 +85,9 @@ void Indexer::save() {
}
else
{
seeker
[
word
.
first
]
=
seekOffset
;
}
string
wordBreak
=
word
.
first
+
"
\n
"
;
write
(
file
,
wordBreak
.
c_str
(),
strlen
(
wordBreak
.
c_str
()));
seekOffset
+=
strlen
(
wordBreak
.
c_str
());
//
string wordBreak = word.first + "\n";
//
write(file, wordBreak.c_str(), strlen(wordBreak.c_str()));
//
seekOffset += strlen(wordBreak.c_str());
for
(
auto
location
:
word
.
second
)
{
string
locationSpace
=
to_string
(
location
)
+
" "
;
write
(
file
,
locationSpace
.
c_str
(),
strlen
(
locationSpace
.
c_str
()));
...
...
This diff is collapsed.
Click to expand it.
indexer/SeekFileTests.cpp
+
2
−
2
View file @
7c04b359
...
...
@@ -10,9 +10,9 @@ using namespace std;
int
main
()
{
int
index1
=
open
(
"index0.txt"
,
O_CREAT
|
O_RDWR
,
S_IRWXU
);
lseek
(
index1
,
1295
45
,
SEEK_SET
);
lseek
(
index1
,
1295
22
,
SEEK_SET
);
char
buffer
[
10
];
if
(
read
(
index1
,
buffer
,
2
0
)
!=
2
0
)
{
if
(
read
(
index1
,
buffer
,
1
0
)
!=
1
0
)
{
cout
<<
"ERROR"
<<
endl
;
}
cout
<<
buffer
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment