Hi John,

In the DSIndexer class, you'll see the following code:

    /**
     * Build a Lucene document for a DSpace Collection.
     * 
     * @param context Users Context
     * @param collection Collection to be indexed
     * @throws SQLException
     * @throws IOException
     */
    private static void buildDocument(Context context, Collection
collection, Term t)  
    throws SQLException, IOException
    {
        String location_text = buildCollectionLocationString(context,
collection);

        // Create Lucene Document
        Document doc = buildDocument(Constants.COLLECTION,
collection.getID(), collection.getHandle(), location_text);

        // and populate it
        String name = collection.getMetadata("name");
        
        if (name != null)
        {
                doc.add(new Field("name", name, Field.Store.NO,
Field.Index.TOKENIZED));
                doc.add(new Field("default", name, Field.Store.NO,
Field.Index.TOKENIZED));
        }
        
        writeDocument(t, doc);
    }

If you want to add extra information to the search index, do the
following:

Under 'String name = collection.getMetadata("name");' add:

String full = collection.getMetadata("name") + " " +
collection.getMetadata("X") + " " + collection.getMetadata("Y");

(where X and Y are the extra fields that you want it to search, for
example 'introductory_text').

Then change:

doc.add(new Field("default", name, Field.Store.NO,
Field.Index.TOKENIZED));

to

doc.add(new Field("default", full, Field.Store.NO,
Field.Index.TOKENIZED));

Thanks,


Stuart Lewis
Digital Services Programmer
Te Tumu Herenga The University of Auckland Library
Auckland Mail Centre, Private Bag 92019, Auckland 1142, New Zealand
Ph: 64 9 373-7599 x81928
http://www.library.auckland.ac.nz/



From: John Preston [mailto:[email protected]] 
Sent: Tuesday, 28 April 2009 2:35 a.m.
To: [email protected]
Subject: [Dspace-tech] Including collection details in search index

Can anyone say what components of the collection details are included,
if any, in then search index, apart from the collection name. I want to
have the collection description text included in the searchable index.
is this possible.

John

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to