Skip to content

[New docs] Java client v6 docs #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,5 @@
"editor.insertSpaces": true
},
"java.configuration.updateBuildConfiguration": "interactive",
"java.compile.nullAnalysis.mode": "automatic",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// How-to: Manage-data -> Delete objects
package io.weaviate.docs;

import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.weaviate.client6.Config;
import io.weaviate.client6.WeaviateClient;

@Tag("crud")
@Tag("delete")
class ManageDataDeleteTest {

private static WeaviateClient client;

@BeforeAll
public static void beforeAll() {
String scheme = EnvHelper.scheme("http");
String host = EnvHelper.host("localhost");
String port = EnvHelper.port("8080");

Config config = new Config(scheme, host + ":" + port);
client = new WeaviateClient(config);
}

@Test
public void shouldManageDataRead() {
// START DeleteObject
String collectionName = "JeopardyQuestion";

// END DeleteObject

deleteObject(collectionName);
}

private void deleteObject(String collectionName) {
// START DeleteObject
var collection = client.collections.use(collectionName);
collection.data.delete(objectIdToDelete);
// END DeleteObject
}
}
30 changes: 19 additions & 11 deletions _includes/code/howto/manage-data.shards.inspect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import FilteredTextBlock from '@site/src/components/Documentation/FilteredTextBl

import PyCode from '!!raw-loader!/_includes/code/howto/manage-data.collections.py';
import JavaCode from '!!raw-loader!/_includes/code/howto/java/src/test/java/io/weaviate/docs/manage-data.classes.java';
import JavaV6Code from "!!raw-loader!/_includes/code/java-v6/src/test/java/ManageCollectionsTest.java";

<Tabs groupId="languages">
<TabItem value="py" label="Python Client v4">
<FilteredTextBlock
text={PyCode}
startMarker="START InspectCollectionShards"
endMarker="END InspectCollectionShards"
language="py"
/>
</TabItem>

<TabItem value="py3" label="Python Client v3">
<TabItem value="py" label="Python Client v4">
<FilteredTextBlock
text={PyCode}
startMarker="START InspectCollectionShards"
endMarker="END InspectCollectionShards"
language="py"
/>
</TabItem>
<TabItem value="py3" label="Python Client v3">

```python
# highlight-start
Expand Down Expand Up @@ -80,7 +80,15 @@ func main() {
}
```

</TabItem>
</TabItem>
<TabItem value="java6" label="Java Client V6">
<FilteredTextBlock
text={JavaV6Code}
startMarker="// START InspectCollectionShards"
endMarker="// END InspectCollectionShards"
language="java"
/>
</TabItem>
<TabItem value="java" label="Java">
<FilteredTextBlock
text={JavaCode}
Expand Down
54 changes: 30 additions & 24 deletions _includes/code/howto/manage-data.shards.update.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import FilteredTextBlock from '@site/src/components/Documentation/FilteredTextBl
import PyCode from '!!raw-loader!/_includes/code/howto/manage-data.collections.py';
import GoCode from '!!raw-loader!/_includes/code/howto/go/docs/manage-data.shards_test.go';
import JavaCode from '!!raw-loader!/_includes/code/howto/java/src/test/java/io/weaviate/docs/manage-data.classes.java';
import JavaV6Code from "!!raw-loader!/_includes/code/java-v6/src/test/java/ManageCollectionsTest.java";

<Tabs groupId="languages">
<TabItem value="py" label="Python Client v4">
<FilteredTextBlock
text={PyCode}
startMarker="START UpdateCollectionShards"
endMarker="END UpdateCollectionShards"
language="py"
/>
</TabItem>

<TabItem value="py3" label="Python Client v3">
<TabItem value="py" label="Python Client v4">
<FilteredTextBlock
text={PyCode}
startMarker="START UpdateCollectionShards"
endMarker="END UpdateCollectionShards"
language="py"
/>
</TabItem>
<TabItem value="py3" label="Python Client v3">

```python
# highlight-start
Expand All @@ -29,8 +29,8 @@ article_shards = client.schema.update_class_shard(
print(article_shards)
```

</TabItem>
<TabItem value="js" label="JS/TS Client v3">
</TabItem>
<TabItem value="js" label="JS/TS Client v3">

```js
let articles = client.collections.get('Article')
Expand All @@ -54,23 +54,29 @@ const shards = await client.schema.shardUpdater()
console.log(JSON.stringify(shards, null, 2));
```

</TabItem>
<TabItem value="go" label="Go">
<FilteredTextBlock
text={GoCode}
startMarker="// UpdateShardStatus START"
endMarker="// UpdateShardStatus END"
language="go"
/>
</TabItem>

<TabItem value="java" label="Java">
</TabItem>
<TabItem value="go" label="Go">
<FilteredTextBlock
text={GoCode}
startMarker="// UpdateShardStatus START"
endMarker="// UpdateShardStatus END"
language="go"
/>
</TabItem>
<TabItem value="java6" label="Java Client V6">
<FilteredTextBlock
text={JavaV6Code}
startMarker="// START UpdateCollectionShards"
endMarker="// END UpdateCollectionShards"
language="java"
/>
</TabItem>
<TabItem value="java" label="Java">
<FilteredTextBlock
text={JavaCode}
startMarker="// UpdateShardStatus START"
endMarker="// UpdateShardStatus END"
language="java"
/>
</TabItem>

</Tabs>
5 changes: 5 additions & 0 deletions _includes/code/java-v6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mvn test


mvn test -Dtest=ConnectionTest

69 changes: 69 additions & 0 deletions _includes/code/java-v6/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.weaviate.examples</groupId>
<artifactId>weaviate-java-client-examples</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Weaviate Java Client Examples</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<!-- Weaviate Java v6 Client -->
<dependency>
<groupId>io.weaviate</groupId>
<artifactId>client6</artifactId>
<version>6.0.0-beta4</version>
</dependency>

<!-- JUnit 5 for testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.25.3</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- Surefire Plugin for running tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</build>
</project>
Loading
Loading