BooleanQuery q = new BooleanQuery();
if ( StringUtils.isNotBlank( searchFields.getGroupId() ) )
{
q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch()
? new SourcedSearchExpression( searchFields.getGroupId() )
: new UserInputSearchExpression( searchFields.getGroupId() )
), Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getArtifactId() ) )
{
q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID,
searchFields.isExactSearch()
? new SourcedSearchExpression( searchFields.getArtifactId() )
: new UserInputSearchExpression( searchFields.getArtifactId() )
), Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getVersion() ) )
{
q.add( indexer.constructQuery( MAVEN.VERSION, searchFields.isExactSearch() ? new SourcedSearchExpression(
searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ), Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getPackaging() ) )
{
q.add( indexer.constructQuery( MAVEN.PACKAGING, searchFields.isExactSearch() ? new SourcedSearchExpression(
searchFields.getPackaging() ) : new UserInputSearchExpression( searchFields.getPackaging() ) ),
Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getClassName() ) )
{
q.add( indexer.constructQuery( MAVEN.CLASSNAMES,
new UserInputSearchExpression( searchFields.getClassName() ) ), Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getBundleSymbolicName() ) )
{
q.add( indexer.constructQuery( OSGI.SYMBOLIC_NAME,
new UserInputSearchExpression( searchFields.getBundleSymbolicName() ) ),
Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getBundleVersion() ) )
{
q.add( indexer.constructQuery( OSGI.VERSION,
new UserInputSearchExpression( searchFields.getBundleVersion() ) ),
Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getBundleExportPackage() ) )
{
q.add( indexer.constructQuery( OSGI.EXPORT_PACKAGE,
new UserInputSearchExpression( searchFields.getBundleExportPackage() ) ),
Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getBundleExportService() ) )
{
q.add( indexer.constructQuery( OSGI.EXPORT_SERVICE,
new UserInputSearchExpression( searchFields.getBundleExportService() ) ),
Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getBundleImportPackage() ) )
{
q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE,
new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ),
Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getBundleName() ) )
{
q.add( indexer.constructQuery( OSGI.NAME, new UserInputSearchExpression( searchFields.getBundleName() ) ),
Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getBundleImportPackage() ) )
{
q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE,
new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ),
Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getBundleRequireBundle() ) )
{
q.add( indexer.constructQuery( OSGI.REQUIRE_BUNDLE,
new UserInputSearchExpression( searchFields.getBundleRequireBundle() ) ),
Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getClassifier() ) )
{
q.add( indexer.constructQuery( MAVEN.CLASSIFIER, searchFields.isExactSearch() ? new SourcedSearchExpression(
searchFields.getClassifier() ) : new UserInputSearchExpression( searchFields.getClassifier() ) ),
Occur.MUST
);
}
else if ( searchFields.isExactSearch() )
{