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
8627de2b
Commit
8627de2b
authored
7 years ago
by
Nicholas Yang
Browse files
Options
Downloads
Patches
Plain Diff
lil bit better isrword
parent
f952cfcc
Branches
Branches containing commit
No related tags found
1 merge request
!17
Bunch of ISR Improvements
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ISRAnd-tests
+0
-0
0 additions, 0 deletions
ISRAnd-tests
constraintSolver/ISRWord.cpp
+22
-25
22 additions, 25 deletions
constraintSolver/ISRWord.cpp
indexer/IndexerConstants.h
+2
-2
2 additions, 2 deletions
indexer/IndexerConstants.h
with
24 additions
and
27 deletions
ISRAnd-tests
+
0
−
0
View file @
8627de2b
No preview for this file type
This diff is collapsed.
Click to expand it.
constraintSolver/ISRWord.cpp
+
22
−
25
View file @
8627de2b
...
...
@@ -47,9 +47,12 @@ Location ISRWord::First ( )
string
currentChunkFileLocation
=
util
::
GetCurrentWorkingDir
(
)
+
IndexerConstants
::
pathToIndex
+
to_string
(
info
.
chunks
[
currentChunk
]
)
+
".txt"
;
int
currentChunkFile
=
open
(
currentChunkFileLocation
.
c_str
(
),
O_RDONLY
);
ssize_t
currentChunkFileSize
=
FileSize
(
currentChunkFile
);
currentMemMap
=
(
char
*
)
mmap
(
nullptr
,
currentChunkFileSize
,
PROT_READ
,
MAP_PRIVATE
,
currentChunkFile
,
0
);
// int currentChunkFile = open( currentChunkFileLocation.c_str( ), O_RDONLY );
// ssize_t currentChunkFileSize = FileSize( currentChunkFile );
// currentMemMap = ( char * ) mmap( nullptr, currentChunkFileSize, PROT_READ, MAP_PRIVATE, currentChunkFile, 0 );
currentMemMap
=
corpus
.
chunks
[
info
.
chunks
[
currentChunk
]].
chunkMap
;
currentMemMap
+=
stoll
(
loc
);
string
firstLoc
=
""
;
while
(
*
currentMemMap
!=
' '
)
{
...
...
@@ -58,7 +61,7 @@ Location ISRWord::First ( )
}
currentMemMap
++
;
getWordSeek
();
currentLocation
=
stoll
(
firstLoc
);
currentLocation
=
stoll
(
firstLoc
);
return
currentLocation
;
}
...
...
@@ -74,7 +77,7 @@ Location ISRWord::First ( )
Location
ISRWord
::
Next
(
)
{
if
(
currentMemMap
&&
*
currentMemMap
==
'\n'
)
if
(
currentMemMap
&&
*
currentMemMap
==
'\n'
||
*
currentMemMap
==
'\0'
)
{
currentChunk
++
;
if
(
info
.
chunks
.
size
(
)
<=
currentChunk
)
...
...
@@ -165,26 +168,19 @@ Location ISRWord::Seek( Location target )
if
(
target
>
getLastLocation
())
return
MAX_Location
;
size_t
lastBest
=
currentChunk
;
Location
potentialChunk
=
info
.
chunks
[
currentChunk
];
//iterate through the chunks in corpus
while
(
potentialChunk
<
info
.
chunks
.
size
()
)
{
//find a potential chunk
if
(
target
<
corpus
.
chunks
[
potentialChunk
].
lastLocation
)
{
lastBest
=
currentChunk
;
potentialChunk
++
;
}
//if past point larger
else
{
currentChunk
=
lastBest
;
break
;
}
}
int
chunk
=
currentChunk
+
1
;
if
(
target
<
corpus
.
chunks
[
info
.
chunks
[
0
]].
lastLocation
)
{
chunk
=
0
;
}
else
{
if
(
chunk
>=
info
.
chunks
.
size
())
{
chunk
--
;
}
while
(
target
>
corpus
.
chunks
[
info
.
chunks
[
chunk
]].
lastLocation
)
{
chunk
++
;
}
chunk
--
;
}
currentChunk
=
chunk
;
//have best chunk, initalize files
First
();
...
...
@@ -201,6 +197,7 @@ Location ISRWord::Seek( Location target )
break
;
}
currentMemMap
=
corpus
.
chunks
[
info
.
chunks
[
currentChunk
]].
chunkMap
;
currentMemMap
+=
best
.
seekOffset
;
currentLocation
=
best
.
realLocation
;
...
...
This diff is collapsed.
Click to expand it.
indexer/IndexerConstants.h
+
2
−
2
View file @
8627de2b
#pragma once
namespace
IndexerConstants
{
const
string
pathToIndex
=
"/buildIndex/"
;
//
const string pathToIndex = "/constraintSolver/index-test-files/twitter/";
//
const string pathToIndex = "/buildIndex/";
const
string
pathToIndex
=
"/constraintSolver/index-test-files/twitter/"
;
const
size_t
maxWordSize
=
30
;
...
...
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