-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve field config api for easier index schema creation
- Loading branch information
Showing
8 changed files
with
155 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
zulia-server/src/test/java/io/zulia/server/test/QueryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package io.zulia.server.test; | ||
|
||
import io.zulia.client.command.builder.ScoredQuery; | ||
import io.zulia.client.command.builder.Search; | ||
import io.zulia.client.command.builder.Sort; | ||
import io.zulia.client.config.ZuliaPoolConfig; | ||
import io.zulia.client.pool.ZuliaWorkPool; | ||
import io.zulia.client.result.SearchResult; | ||
import io.zulia.message.ZuliaQuery; | ||
|
||
public class QueryTest { | ||
|
||
public static void main(String[] args) throws Exception { | ||
ZuliaWorkPool zuliaWorkPool = new ZuliaWorkPool(new ZuliaPoolConfig().addNode("localhost")); | ||
|
||
Search search = new Search("publicgrants20220303"); | ||
search.setAmount(500); | ||
search.addQuery(new ScoredQuery("breast AND cancer").addQueryFields("title", "abstract")); | ||
search.addDocumentFields("title", "abstract"); | ||
|
||
SearchResult searchResult = zuliaWorkPool.search(search); | ||
System.out.println(searchResult.getTotalHits()); | ||
System.out.println("breast AND cancer Top 100," + searchResult.getCommandTimeMs()); | ||
|
||
search.addSort(new Sort("title")); | ||
searchResult = zuliaWorkPool.search(search); | ||
System.out.println("breast AND cancer Top 100 Sort Title," + searchResult.getCommandTimeMs()); | ||
|
||
search.clearSort(); | ||
long start = System.currentTimeMillis(); | ||
zuliaWorkPool.searchAllAsDocument(search, document -> { | ||
//no-op | ||
}); | ||
long end = System.currentTimeMillis(); | ||
System.out.println("breast AND cancer All Matches," + (end-start)); | ||
|
||
search.setResultFetchType(ZuliaQuery.FetchType.NONE); | ||
search.clearSort(); | ||
search.clearLastResult(); | ||
search.addSort(new Sort("id")); | ||
start = System.currentTimeMillis(); | ||
zuliaWorkPool.searchAllAsScoredResult(search, scoredResult -> { | ||
//no-op | ||
}); | ||
end = System.currentTimeMillis(); | ||
System.out.println("breast AND cancer All Matches Sort Id (None)," + (end-start)); | ||
|
||
search.setResultFetchType(ZuliaQuery.FetchType.FULL); | ||
search.clearSort(); | ||
search.clearLastResult(); | ||
search.addSort(new Sort("id")); | ||
start = System.currentTimeMillis(); | ||
zuliaWorkPool.searchAllAsDocument(search, document -> { | ||
//no-op | ||
}); | ||
end = System.currentTimeMillis(); | ||
System.out.println("breast AND cancer All Matches Sort Id (Full)," + (end-start)); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.