Skip to content

Commit 49b3a63

Browse files
committed
Fix casing and convention on static variable
1 parent 32f9968 commit 49b3a63

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

server/src/main/java/dev/findfirst/core/service/TypesenseService.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
@Slf4j
2828
public class TypesenseService {
2929

30-
public record SearchHighlightResult(Long id, String highlight) {}
30+
public record SearchHighlightResult(Long id, String highlight) {
31+
}
3132

3233
private final TypsenseInitializationRepository initRepo;
3334

3435
private final Client client;
3536

36-
private final static String schemaName = "bookmark";
37+
private static final String SCHEMA_NAME = "bookmark";
3738

3839
@PostConstruct
3940
public String createSchema() {
@@ -49,16 +50,15 @@ public String createSchema() {
4950

5051
private CollectionSchema createCollectionSchemaSchema() {
5152
CollectionSchema collectionSchema = new CollectionSchema();
52-
collectionSchema.name(schemaName)
53+
collectionSchema.name(SCHEMA_NAME)
5354
.addFieldsItem(new Field().name("title").type(FieldTypes.STRING))
5455
.addFieldsItem(new Field().name("text").type(FieldTypes.STRING));
5556
return collectionSchema;
5657
}
5758

5859
private String saveSchema(TypesenseInitRecord initRecord) {
5960
try {
60-
CollectionResponse collectionResponse =
61-
client.collections().create(createCollectionSchemaSchema());
61+
CollectionResponse collectionResponse = client.collections().create(createCollectionSchemaSchema());
6262
log.debug(collectionResponse.toString());
6363
initRecord.setInitialized(true);
6464
initRepo.save(initRecord);
@@ -82,7 +82,7 @@ public void addText(BookmarkJDBC bookmark, Document retDoc) {
8282
document.put("text", retDoc.text());
8383

8484
try {
85-
client.collections(schemaName).documents().create(document);
85+
client.collections(SCHEMA_NAME).documents().create(document);
8686
} catch (Exception e) {
8787
log.error(e.toString());
8888
}
@@ -93,8 +93,7 @@ public List<SearchHighlightResult> search(String text) {
9393
.highlightFields("text").highlightStartTag("<mark>").highlightEndTag("</mark>");
9494
try {
9595
log.debug("searching");
96-
SearchResult searchResult =
97-
client.collections(schemaName).documents().search(searchParameters);
96+
SearchResult searchResult = client.collections(SCHEMA_NAME).documents().search(searchParameters);
9897
log.debug(searchResult.toString());
9998

10099
return searchResult.getHits().stream().map(hit -> {

0 commit comments

Comments
 (0)