Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
lucene
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohamad.alturky
lucene
Commits
59d24da3
Commit
59d24da3
authored
Mar 25, 2024
by
mohamad.alturky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixing
parent
32c043cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
2 deletions
+35
-2
Lucene.java
src/main/java/com/search/lucene/Lucene.java
+7
-2
Benchmarker.java
src/main/java/com/search/lucene/performance/Benchmarker.java
+23
-0
RunnableTask.java
...main/java/com/search/lucene/performance/RunnableTask.java
+5
-0
No files found.
src/main/java/com/search/lucene/Lucene.java
View file @
59d24da3
...
...
@@ -9,6 +9,7 @@ import com.search.lucene.engine.abstractions.ISearchEngine;
import
com.search.lucene.engine.builder.abstractions.IEngineBuilder
;
import
com.search.lucene.engine.builder.implementations.LuceneEngineBuilder
;
import
com.search.lucene.indexers.implementations.TextFileIndexer
;
import
com.search.lucene.performance.Benchmarker
;
import
com.search.lucene.searchers.implementations.IndexedDocumentSearcher
;
import
com.search.lucene.settings.Constants
;
import
org.apache.lucene.document.Document
;
...
...
@@ -18,10 +19,14 @@ import org.apache.lucene.search.TopDocs;
public
class
Lucene
{
public
static
void
main
(
String
[]
args
)
throws
IOException
,
Parse
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
IEngineBuilder
builder
=
new
LuceneEngineBuilder
();
ISearchEngine
searchEngine
=
builder
.
build
();
searchEngine
.
createIndexesForDirectory
(
"data"
);
Benchmarker
.
benchmark
(()
->
{
searchEngine
.
createIndexesForDirectory
(
"data"
);
});
ArrayList
<
Document
>
results
=
searchEngine
.
search
(
"Julien Leclercq"
);
IDocumentRepresenterResolver
<
String
>
resolver
=
new
DocumentToStringRepresenterResolver
();
...
...
src/main/java/com/search/lucene/performance/Benchmarker.java
0 → 100644
View file @
59d24da3
package
com
.
search
.
lucene
.
performance
;
import
java.util.concurrent.Callable
;
import
java.util.function.Function
;
public
class
Benchmarker
{
public
static
<
T
>
T
benchmark
(
Callable
<
T
>
callable
)
throws
Exception
{
long
startTime
=
System
.
currentTimeMillis
();
T
t
=
callable
.
call
();
long
endTime
=
System
.
currentTimeMillis
();
long
time
=
endTime
-
startTime
;
System
.
out
.
println
(
"The Function "
+
callable
.
getClass
().
getName
()
+
" takes "
+
time
+
" ms"
);
return
t
;
}
public
static
void
benchmark
(
RunnableTask
callable
)
throws
Exception
{
long
startTime
=
System
.
currentTimeMillis
();
callable
.
run
();
long
endTime
=
System
.
currentTimeMillis
();
long
time
=
endTime
-
startTime
;
System
.
out
.
println
(
"The Function "
+
callable
.
getClass
().
getName
()
+
" takes "
+
time
+
" ms"
);
}
}
src/main/java/com/search/lucene/performance/RunnableTask.java
0 → 100644
View file @
59d24da3
package
com
.
search
.
lucene
.
performance
;
public
interface
RunnableTask
{
void
run
()
throws
Exception
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment