Skip to content

support lucene search #101

@jamlevi

Description

@jamlevi

Often, we need to get_latest_version so we call get_artifact_info and we do get the latest version - chronologically. But, what if I want the latest version on a branch and another branch has a newer version. The result returns the latest, but not lexically. Is there currently a way to do that? I don't see one, but it looks like the lucene search can do this if one passes a branch.* wildcard like this:

hxxps://your.nexus.here/nexus/service/local/lucene/search?g=com.mycompany&a=myartifact&repositoryId=releases&v=4.6.*

I think, to support this, I can just add a new artifact_task method like this ?

def search_artifacts_lucene(coordinates)
  artifact = Artifact.new(coordinates)

  query = {:g => artifact.group_id, :a => artifact.artifact_id, :e => artifact.extension, :v => artifact.version,
           :r => configuration['repository']}
  query.merge!({:c => artifact.classifier}) unless artifact.classifier.nil?
  response = nexus.get(nexus_url("service/local/artifact/lucene/search"), query)
  puts response.inspect
  case response.status
    when 200
      return response.content
    else
      raise UnexpectedStatusCodeException.new(response.status)
  end
end

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions