Skip to content

Commit

Permalink
feat: fix db
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed Nov 10, 2023
1 parent f9f2f54 commit 65c0655
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.client.AiClient;
import org.springframework.ai.client.AiResponse;
import org.springframework.ai.client.Generation;
Expand All @@ -38,7 +40,8 @@
@Service
@Transactional
public class DocumentService {
private final static String ID = "id";
private static final Logger LOGGER = LoggerFactory.getLogger(DocumentService.class);
private static final String ID = "id";
private final DocumentRepository documentRepository;
private final DocumentVsRepository documentVsRepository;
private final AiClient aiClient;
Expand All @@ -64,6 +67,7 @@ public Long storeDocument(Document document) {
myDocument1.getMetadata().put(ID, myDocument.getId());
return Stream.of(myDocument1);
}).toList();
LOGGER.info("Name: {}, size: {}", document.getDocumentName(), documents.size());
this.documentVsRepository.add(documents);
return Optional.ofNullable(myDocument.getDocumentContent()).stream()
.map(myContent -> Integer.valueOf(myContent.length).longValue()).findFirst().orElse(0L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="angular2guy" id="1">
<changeSet id="1" author="angular2guy">
<sql>CREATE EXTENSION if not exists hstore SCHEMA public;</sql>
</changeSet>
<changeSet author="angular2guy" id="2">
<createTable tableName="document">
<column name="id" type="bigint">
<constraints primaryKey="true"/>
Expand All @@ -25,7 +28,7 @@
<column name="document_content" type="blob"/>
</createTable>
</changeSet>
<changeSet author="angular2guy" id="2">
<changeSet author="angular2guy" id="3">
<createSequence sequenceName="document_seq" incrementBy="50"
startValue="1000" />
</changeSet>
Expand Down

0 comments on commit 65c0655

Please sign in to comment.