Nexus-indexer API: Searching for all (primary) artifacts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Nexus-indexer API: Searching for all (primary) artifacts

Andreas Sewe
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Nexus-indexer API: Searching for all (primary) artifacts

Tamás Cservenák
Your use case ("search for all...") is not exactly a search, is it?

In cases like this you can simply iterate over the index entries.

See example of doing this here:

Note of warning: this code above is a bit broken, IndexUtils.constructArtifactInfo might return null, so a nullcheck would be needed before inspecting field values.


Thanks,
~t~


On Wed, Jan 16, 2013 at 12:21 PM, Andreas Sewe <[hidden email]> wrote:
Hi all,

(and apologies if that's the wrong mailing list; wasn't sure whether to
pick nexus-dev or nexus-users)

I am using the nexus-indexer API and so far it works quite nicely. Alas,
I am having problems with queries of the following type: (1) "all
artifacts" or (2) "all artifacts without a classifier".

As far as I can see, Lucene always wants at least one Occur.MUST clause,
so for use case (1) I resorted to this workaround:

  BooleanQuery query = new BooleanQuery();
  query.add(indexer.constructQuery(MAVEN.PACKAGING, "*",
SearchType.EXACT), Occur.MUST);

This works, as every artifact has a packaging, but the wildcard query
seems to be expanded into a huge list of clauses (on some larger indexes
Lucene even complains that "maxClauseCount is set to 1024") and is
consequently very slow.

Use case (2) suffers from similar issues; I need the above Occur.MUST
clause (a Occur.MUST_NOT doesn't seem to be sufficient):

  query.add(indexer.constructQuery(MAVEN.CLASSIFIER, "*",
SearchType.EXACT), Occur.MUST_NOT);

Any suggestions how to be smarter about this?

Best wishes,

Andreas
--
Codetrails.com - the knowledge transfer company

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Nexus-indexer API: Searching for all (primary) artifacts

Brian Fox
In reply to this post by Andreas Sewe
Hi Andreas, what's the use case for enumerating every artifact from the index?

On Wed, Jan 16, 2013 at 6:21 AM, Andreas Sewe <[hidden email]> wrote:
Hi all,

(and apologies if that's the wrong mailing list; wasn't sure whether to
pick nexus-dev or nexus-users)

I am using the nexus-indexer API and so far it works quite nicely. Alas,
I am having problems with queries of the following type: (1) "all
artifacts" or (2) "all artifacts without a classifier".

As far as I can see, Lucene always wants at least one Occur.MUST clause,
so for use case (1) I resorted to this workaround:

  BooleanQuery query = new BooleanQuery();
  query.add(indexer.constructQuery(MAVEN.PACKAGING, "*",
SearchType.EXACT), Occur.MUST);

This works, as every artifact has a packaging, but the wildcard query
seems to be expanded into a huge list of clauses (on some larger indexes
Lucene even complains that "maxClauseCount is set to 1024") and is
consequently very slow.

Use case (2) suffers from similar issues; I need the above Occur.MUST
clause (a Occur.MUST_NOT doesn't seem to be sufficient):

  query.add(indexer.constructQuery(MAVEN.CLASSIFIER, "*",
SearchType.EXACT), Occur.MUST_NOT);

Any suggestions how to be smarter about this?

Best wishes,

Andreas
--
Codetrails.com - the knowledge transfer company

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Nexus-indexer API: Searching for all (primary) artifacts

Andreas Sewe
CONTENTS DELETED
The author has deleted this message.