mirror of
https://github.com/apache/archiva.git
synced 2025-02-20 00:46:48 +00:00
boost artifactid fields
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-search-improvements@726179 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8daf21e21f
commit
1d3352a6a4
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer
@ -54,8 +54,8 @@ public Document convert( LuceneRepositoryContentRecord record )
|
||||
// Artifact Reference
|
||||
doc.addFieldTokenized( ArtifactKeys.GROUPID, filecontent.getArtifact().getGroupId() );
|
||||
doc.addFieldExact( ArtifactKeys.GROUPID_EXACT, filecontent.getArtifact().getGroupId() );
|
||||
doc.addFieldTokenized( ArtifactKeys.ARTIFACTID, filecontent.getArtifact().getArtifactId() );
|
||||
doc.addFieldExact( ArtifactKeys.ARTIFACTID_EXACT, filecontent.getArtifact().getArtifactId() );
|
||||
doc.addFieldTokenized( ArtifactKeys.ARTIFACTID, filecontent.getArtifact().getArtifactId(), 1.5f );
|
||||
doc.addFieldExact( ArtifactKeys.ARTIFACTID_EXACT, filecontent.getArtifact().getArtifactId(), 1.5f );
|
||||
doc.addFieldTokenized( ArtifactKeys.VERSION, filecontent.getArtifact().getVersion() );
|
||||
doc.addFieldExact( ArtifactKeys.VERSION_EXACT, filecontent.getArtifact().getVersion() );
|
||||
doc.addFieldTokenized( ArtifactKeys.TYPE, filecontent.getArtifact().getType() );
|
||||
|
@ -81,6 +81,18 @@ public LuceneDocumentMaker addFieldTokenized( String key, String value )
|
||||
return this;
|
||||
}
|
||||
|
||||
public LuceneDocumentMaker addFieldTokenized( String key, String value, float boost )
|
||||
{
|
||||
if ( value != null )
|
||||
{
|
||||
Field field = new Field( key, value, Field.Store.YES, Field.Index.TOKENIZED );
|
||||
field.setBoost(boost);
|
||||
document.add( field );
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public LuceneDocumentMaker addFieldTokenized( String key, List list )
|
||||
{
|
||||
if ( ( list != null ) && ( !list.isEmpty() ) )
|
||||
@ -101,6 +113,18 @@ public LuceneDocumentMaker addFieldUntokenized( String name, String value )
|
||||
return this;
|
||||
}
|
||||
|
||||
public LuceneDocumentMaker addFieldUntokenized( String name, String value, float boost )
|
||||
{
|
||||
if ( value != null )
|
||||
{
|
||||
Field field = new Field( name, value, Field.Store.YES, Field.Index.UN_TOKENIZED );
|
||||
field.setBoost(boost);
|
||||
document.add( field );
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public LuceneDocumentMaker addFieldExact( String name, String value )
|
||||
{
|
||||
if ( value != null )
|
||||
@ -111,6 +135,18 @@ public LuceneDocumentMaker addFieldExact( String name, String value )
|
||||
return this;
|
||||
}
|
||||
|
||||
public LuceneDocumentMaker addFieldExact( String name, String value, float boost )
|
||||
{
|
||||
if ( value != null )
|
||||
{
|
||||
Field field = new Field( name, value, Field.Store.NO, Field.Index.UN_TOKENIZED );
|
||||
field.setBoost(boost);
|
||||
document.add( field );
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Document getDocument()
|
||||
{
|
||||
return this.document;
|
||||
|
Loading…
x
Reference in New Issue
Block a user