diff --git a/.github/workflows/maven-package.yml b/.github/workflows/maven-package.yml new file mode 100644 index 0000000..58344a5 --- /dev/null +++ b/.github/workflows/maven-package.yml @@ -0,0 +1,17 @@ +name: Java CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + - name: Build with Maven + run: mvn --batch-mode --update-snapshots package \ No newline at end of file diff --git a/.github/workflows/mavenpublish.yml b/.github/workflows/mavenpublish.yml deleted file mode 100644 index 23eedb2..0000000 --- a/.github/workflows/mavenpublish.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path - -name: Maven Package - -on: - release: - types: [created] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Java 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Build with Maven - run: mvn -B package --file pom.xml - - - name: Publish to GitHub Packages Apache Maven - run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml - env: - GITHUB_TOKEN: ${{ github.token }} diff --git a/.gitignore b/.gitignore index 49ccfce..260efb9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,11 @@ /target my-idx -.settings/ -.project +*.iml +*.swp +.DS_Store .classpath .idea/ -*.iml -dependency-reduced-pom.xml +.project +.sdkmanrc +.settings +dependency-reduced-pom.xml \ No newline at end of file diff --git a/README.md b/README.md index d6aa94c..de64319 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ -CLue - Command Line tool for Apache Lucene +CLue - Command Line Tool for Apache Lucene ========================================== -### Overview: +## Overview When working with Lucene, it is often useful to inspect an index. -[Luke](http://www.getopt.org/luke/) is awesome, but often times it is not feasible to inspect an index on a remote machine using a GUI. That's where Clue comes in. +[Luke](http://www.getopt.org/luke/) is awesome, but often times it is not feasible to inspect an index on a remote +machine using a GUI. That's where Clue comes in. You can ssh into your production box and inspect your index using your favorite shell. Another important feature for Clue is the ability to interact with other Unix commands via piping, e.g. grep, more etc. -#### License: +## About this fork -Clue is under the [Apache Public License v2.0](http://www.apache.org/licenses/LICENSE-2.0.html). +This is a fork from the upstream version: [javasoze/clue](https://github.com/javasoze/clue/). It's built for Lucene 8 +and requires Java 8 (instead of Java 11, which is needed for newer versions of Lucene). -#### Bugs: +### License + +Clue is under the [Apache Public License v2.0](http//www.apache.org/licenses/LICENSE-2.0.html). + +### Bugs Please file bugs and feature requests [here](https://github.com/javasoze/clue/issues). -### Downloads: +## Downloads -latest version: 8.5.0-1.0.0 +latest version: java8-8.11.2-1.0.0 -#### What's new in this release? +### What's new in this release? -See [Release Note](https://github.com/javasoze/clue/releases/tag/release-8.5.0-1.0.0) +See [Release Note](https://github.com/cavorite/clue/releases/tag/release-java8-8.11.2-1.0.0) -### Build: +## Build mvn package @@ -34,7 +40,7 @@ This will create the following artifact in the target directory: ```clue-${VERSION}.jar``` -### Run: +## Run Interactive Mode: @@ -73,54 +79,53 @@ Command list: terms - gets terms from the index, , term can be a prefix trim - trims the index, , options are: head, tail, random tv - shows term vector of a field for a doc - -### Build a sample index to play with: + +## Build a sample index to play with Clue bundles with some test data (15000 car data) for you to build a sample index to play with, do: ./bin/build_sample_index.sh my-idx - -### Examples: +## Examples 1. Getting all the terms in the field 'color_indexed': - **./bin/clue.sh my-idx terms color_indexed** + ``./bin/clue.sh my-idx terms color_indexed`` 2. Getting all the terms in the field 'color_indexed' starting with the term staring with 'r': - **./bin/clue.sh my-idx terms color_indexed:r** + ``./bin/clue.sh my-idx terms color_indexed:r`` + + ``./bin/clue.sh my-idx terms color_indexed | grep r`` + +4. Do a search: - **./bin/clue.sh my-idx terms color_indexed | grep r** + ``./bin/clue.sh my-idx search myquery`` -3. Do a search: +5. Get the index info: - **./bin/clue.sh my-idx search myquery** + ``./bin/clue.sh my-idx info`` -4. Get the index info: +6. Iterate a posting for the term color_indexed:red - **./bin/clue.sh my-idx info** + ``./bin/clue.sh my-idx postings color_indexed:red`` -5. Iterate a posting for the term color_indexed:red +7. List docvalues for the column-stride-field color: - **./bin/clue.sh my-idx postings color_indexed:red** + ``./bin/clue.sh my-idx docval color`` -6. List docvalues for the column-stride-field color: +8. Get docvalue for the column-stride-field *category* for document 4: - **./bin/clue.sh my-idx docval color** + ``./bin/clue.sh my-idx docval *category* 5`` -7. Get docvalue for the column-stride-field *category* for document 4: +9. Get docvalue for the column-stride-field *year* of type numeric for document 3: - **./bin/clue.sh my-idx docval *category* 5** + ``./bin/clue.sh my-idx docval year 3`` -8. Get docvalue for the column-stride-field *year* of type numeric for document 3: +10. Get docvalue for the column-stride-field *json* of type binary for document 3: - **./bin/clue.sh my-idx docval year 3** - -9. Get docvalue for the column-stride-field *json* of type binary for document 3: + ``./bin/clue.sh my-idx docval json 3`` - **./bin/clue.sh my-idx docval json 3** - -9. Get docvalue for the column-stride-field *tags* of type sorted-set for document 3: +11. Get docvalue for the column-stride-field *tags* of type sorted-set for document 3: - **./bin/clue.sh my-idx docval tags 3** + ``./bin/clue.sh my-idx docval tags 3`` diff --git a/pom.xml b/pom.xml index dafe453..d5703b9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ clue jar clue - 8.5.0-1.0.0 + java8-8.11.2-1.0.0 command line client for Apache Lucene http://github.com/javasoze/clue @@ -20,9 +20,9 @@ - scm:git://github.com/javasoze/clue.git - scm:git@github.com:javasoze/clue.git - http://github.com/javasoze/clue + scm:git://github.com/cavorite/clue.git + scm:git@github.com:cavorite/clue.git + http://github.com/cavorite/clue @@ -31,92 +31,60 @@ John Wang john.wang@gmail.com + + cavorite + Juan Manuel Caicedo Carvajal + https://cavorite.com + UTF-8 io.dashbase.clue.ClueApplication - 8.5.0 + 8.11.2 1.3.5 2.5.0 - maven-compiler-plugin 2.1 - 10 - 10 + 8 + 8 UTF-8 - org.apache.maven.plugins - maven-dependency-plugin - 3.1.1 - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory}/libs - false - false - true - - - - - - - - org.kuali.maven.wagons - maven-s3-wagon - 1.2.1 - + + + org.kuali.maven.wagons + maven-s3-wagon + 1.2.1 + @@ -240,10 +208,10 @@ - github - clue - https://maven.pkg.github.com/javasoze/clue + github + clue + https://maven.pkg.github.com/javasoze/clue - + diff --git a/src/main/java/io/dashbase/clue/client/ClueCommandClient.java b/src/main/java/io/dashbase/clue/client/ClueCommandClient.java index ff638e0..4f23407 100644 --- a/src/main/java/io/dashbase/clue/client/ClueCommandClient.java +++ b/src/main/java/io/dashbase/clue/client/ClueCommandClient.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.io.ByteStreams; import jline.console.ConsoleReader; import jline.console.completer.ArgumentCompleter; import jline.console.completer.Completer; @@ -121,8 +122,7 @@ public void handleCommand(String cmdName, String[] args, PrintStream out) { Response response = call.execute(); try (ResponseBody responseBody = response.body()) { - InputStream is = responseBody.byteStream(); - is.transferTo(System.out); + ByteStreams.copy(responseBody.byteStream(), System.out); } } catch (Exception e) { e.printStackTrace(out);