The ability to do this is not built-in currently, regardless of what it implies in the documentation.

The patch to add your own fields is very simple, we are discussing adding this ATM on the dev list.

Just incase you are in too much of a hurry .... I have added 'title' and 'summary' fields to my index with the following patch (cocoon-2.1-dev):

RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/search/ LuceneIndexContentHandler.java,v
retrieving revision 1.5
diff -r1.5 LuceneIndexContentHandler.java
198c198,205
< bodyDocument.add(Field.UnStored(lname, text.toString()));
---
> if (lname.equals("title")) {
> bodyDocument.add(Field.UnIndexed(lname, text.toString()));
> }
> if (lname.equals("summary")) {
> bodyDocument.add(Field.UnIndexed(lname, text.toString()));
> }
> // add the title/summary to both, so content is indexed
> bodyDocument.add(Field.UnStored(lname, text.toString()));

What I do is to have a special xslt on my 'content-view' which strips out everything I do not want searched, and decides what to make a 'title' and what a 'summary'.

The patch adds _every_ <title/> or <summary/> it finds to the index.

Hope this helps

regards Jeremy





On Monday, Nov 18, 2002, at 14:30 Europe/London, [EMAIL PROTECTED] wrote:



...create my own indexing xsp page to allow me to include document
elements in my HitWrapper object so I can output something meaningful as
my search results?

I can't find anything out there that shows how to use the cocoon specific
classes to include things like <title> element or other custom xml
elements in the index.
I have iterated over the Fields enumeration object of the lucene.Document
and have only the url field available (included in the index). However, I
can perform searches like

heading:sometext

and this is only performed on these xml elements, so why can't I get
'heading' output in the Hits object???

This is driving me potty. Do I have to write my own class using the
lucene classes if I am to get this to work, if so, it seems pretty
pointless in having the index example (and specific lucene cocoon
classes) if all you can output is the url - not very user friendly.

TIA
Conrad



Conrad Crampton J
Software Solutions
Kent Police
FHQ
11 Edinburgh Square
Sutton Road
Maidstone
Kent
ME15 9BZ

(01622 652869
19 2869

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to