Skip to content
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

Fixes for a couple of bugs #171

Closed
wants to merge 7 commits into from
Closed
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
22 changes: 9 additions & 13 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ jobs:
- name: Run Tests
if: github.event_name == 'pull_request'
id: tests
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: check
- name: Run Build
if: github.event_name == 'push'
id: build
uses: gradle/gradle-build-action@v2
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: build
- name: Publish Test Report
Expand All @@ -53,18 +51,16 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Publish to repo.grails.org
id: publish
uses: gradle/gradle-build-action@v2
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8'
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Publish to nexus.ala.org.au
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: publish
env:
TRAVIS_DEPLOY_USERNAME: ${{secrets.DEPLOY_USERNAME}}
TRAVIS_DEPLOY_PASSWORD: ${{secrets.DEPLOY_PASSWORD}}
- name: Generate Documentation
id: docs
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
if: success() && github.event_name == 'push' && matrix.java == '8'
with:
arguments: docs
Expand All @@ -78,4 +74,4 @@ jobs:
FOLDER: build/docs/manual
DOC_FOLDER: gh-pages
COMMIT_EMAIL: [email protected]
COMMIT_NAME: Puneet Behl
COMMIT_NAME: Puneet Behl
36 changes: 19 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
buildscript {
repositories {
mavenLocal ()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
Expand All @@ -19,7 +20,7 @@ group "org.grails.plugins"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-plugin"
apply plugin: "org.grails.internal.grails-plugin-publish"
//apply plugin: "org.grails.internal.grails-plugin-publish"
apply plugin: "org.grails.grails-gsp"
apply plugin: "de.undercouch.download"

Expand Down Expand Up @@ -73,6 +74,7 @@ dependencies {
compile "org.elasticsearch:elasticsearch:${elasticsearchVersion}"
compile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-client', version: elasticsearchVersion
compile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: elasticsearchVersion
compile "org.mongodb:mongodb-driver:3.9.1"
compile group: 'org.locationtech.spatial4j', name: 'spatial4j', version: '0.8'

console "org.grails:grails-console"
Expand Down Expand Up @@ -126,20 +128,20 @@ apply from: "gradle/documentation.gradle"

apply from: "gradle/publish.gradle"

grailsPublish {
githubSlug = 'grails-plugins/elasticsearch-grails-plugin'
license {
name = 'Apache-2.0'
}
title = "Elasticsearch Grails Plugin"
//rep = "grails-plugins"
desc = "An Elasticsearch plugin for Grails"
developers = [
noam: 'Noam Y. Tenne',
macrcos: 'Marcos Carceles',
puneet: 'Puneet Behl',
james: 'James Kleeh',
cgoit: 'Carsten Götzinger'
]
}
//grailsPublish {
// githubSlug = 'grails-plugins/elasticsearch-grails-plugin'
// license {
// name = 'Apache-2.0'
// }
// title = "Elasticsearch Grails Plugin"
// //rep = "grails-plugins"
// desc = "An Elasticsearch plugin for Grails"
// developers = [
// noam: 'Noam Y. Tenne',
// macrcos: 'Marcos Carceles',
// puneet: 'Puneet Behl',
// james: 'James Kleeh',
// cgoit: 'Carsten Götzinger'
// ]
//}

6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
projectVersion=3.0.0-SNAPSHOT
grailsVersion=4.1.0
projectVersion=3.0.0.M1.ALA-SNAPSHOT
grailsVersion=4.0.13
grailsGradlePluginVersion=4.0.13
gormHibernateVersion=7.0.5
elasticsearchVersion=7.8.0
elasticsearchVersion=7.8.1

org.gradle.caching=true
org.gradle.daemon=true
35 changes: 34 additions & 1 deletion gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,37 @@ githubPages {
}
}

task publishDocs(dependsOn: [docs, publishGhPages])
task publishDocs(dependsOn: [docs, publishGhPages])

apply plugin:"maven-publish"
publishing {
repositories {
maven {
name 'Nexus'
url "https://nexus.ala.org.au/content/repositories/${project.version.endsWith('-SNAPSHOT') ? 'snapshots' : 'releases'}"
credentials {
username = System.getenv('TRAVIS_DEPLOY_USERNAME')
password = System.getenv('TRAVIS_DEPLOY_PASSWORD')
}
}
}
publications {
mavenJar(MavenPublication) {

pom.withXml {
def pomNode = asNode()
pomNode.dependencyManagement.replaceNode {}

// simply remove dependencies without a version
// version-less dependencies are handled with dependencyManagement
// see https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/8 for more complete solutions
pomNode.dependencies.dependency.findAll {
it.version.text().isEmpty()
}.each {
it.replaceNode {}
}
}
artifact bootJar
}
}
}
3 changes: 3 additions & 0 deletions grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ spring:
- grails-app/views/**
- grails-app/i18n/**
- grails-app/conf/**
autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
management:
endpoints:
enabled-by-default: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import grails.plugins.elasticsearch.index.IndexRequestQueue
import grails.plugins.elasticsearch.mapping.SearchableClassMapping
import grails.plugins.elasticsearch.util.GXContentBuilder
import groovy.util.logging.Slf4j
import org.bson.types.MinKey
import org.elasticsearch.action.search.SearchRequest
import org.elasticsearch.action.search.SearchResponse
import org.elasticsearch.client.RequestOptions
Expand Down Expand Up @@ -58,6 +59,7 @@ class ElasticSearchService implements GrailsApplicationAware {

private static final int INDEX_REQUEST = 0
private static final int DELETE_REQUEST = 1
static final String MONGO_DATABASE = "mongoDatastore"

GrailsApplication grailsApplication
ElasticSearchHelper elasticSearchHelper
Expand Down Expand Up @@ -352,13 +354,24 @@ class ElasticSearchService implements GrailsApplicationAware {
}
}*/
long offset = 0L
def id = new MinKey()
(1..rounds).each { round ->
try {
log.debug("Bulk index iteration $round: fetching $max results starting from ${offset}")
persistenceInterceptor.init()
persistenceInterceptor.setReadOnly()

List<Class<?>> results = domainClass.listOrderById([offset: offset, max: max, readOnly: true, sort: 'id', order: "asc"])
List<Class<?>> results
switch (grailsApplication.config.elasticsearch.datastoreImpl) {
case MONGO_DATABASE:
results = domainClass.createCriteria().list([offset: 0, max: max, readOnly: true, sort: 'id', order: "asc"]) {
gt 'id', id
}
break
default:
results = domainClass.listOrderById([offset: offset, max: max, readOnly: true, sort: 'id', order: "asc"])
break
}

// set lastId for next run
offset = round * max
Expand All @@ -372,6 +385,7 @@ class ElasticSearchService implements GrailsApplicationAware {
indexRequestQueue.addDeleteRequest(entry)
log.debug("Adding the document ${entry.id} to the delete request queue")
}
id = entry.id
}
indexRequestQueue.executeRequests()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ class SearchableClassPropertyMapping {
* @return true if field is analyzed. NOTE it doesn't have to be stored.
*/
boolean isAnalyzed() {
String index = (String) mappingAttributes.index
(index == null || index)
mappingAttributes.get('index') != null ? mappingAttributes.get('index') == 'false' : true
}

/**
Expand Down