[opencms-dev] Results in lucene module

Hitesh hitesh.patel at tatainfotech.com
Tue Oct 5 14:30:55 CEST 2004


Hi farnaz,

you need to change the file BodyLessDocument.java under net.grcomputing.lucence..... something.

Note: you should lucene1.5 which contains good code not supported in lucene.1.2 pakage.
i am using that only.

Properties props = new Properties();
  try {
   props.load(new FileInputStream(CmsBase.getBasePath()+"config/opencms.properties")); 
  }catch(Exception e) {
   System.out.println("proprties file could not load correctly.");
   e.printStackTrace();
  }
  docprops=props.getProperty("docproperty");
  StringTokenizer tokens = new StringTokenizer(docprops,",");
  int numberOfTokens = tokens.countTokens();
  int i = 0;
  String property = "";
  String propvalue = "";
  while(i<numberOfTokens){
   property = tokens.nextToken();
   System.out.println("prperty-->"+property);
   if((propvalue = cmso.readProperty(absPath, property)) != null) {
    System.out.println("propvalue-->"+propvalue);
    doc.add(Field.Text(property,propvalue ));
    doc.add(Field.UnStored(FIELD_BULK, propvalue));
   }
   i++; 
  }

since i've configured that in such a way that u can define properties needs to b indexed can be added in properties files. this is code if you want 
to add the fields directly into code.

you can add this.

String title, description, keywords, author;
  

  if((title = cmso.readProperty(absPath, "title")) != null) {
   doc.add(Field.Text(FIELD_TITLE, title));
   doc.add(Field.UnStored(FIELD_BULK, title));
  }
  if((description = cmso.readProperty(absPath, "description")) != null) {
   doc.add(Field.Text(FIELD_DESC, description));
   doc.add(Field.UnStored(FIELD_BULK, description));
  }
  if((keywords = cmso.readProperty(absPath, "keywords")) != null) {
   doc.add(Field.Text(FIELD_KEYWORDS, keywords));
   doc.add(Field.UnStored(FIELD_BULK, keywords));
  }
  if((author = cmso.readProperty(absPath, "author")) != null) {
   doc.add(Field.Text(FIELD_AUTHOR, author));
   doc.add(Field.UnStored(FIELD_BULK, author));
  }
  if((author = cmso.readProperty(absPath, "value")) != null) {
   doc.add(Field.Text("value", author));
   doc.add(Field.UnStored(FIELD_BULK, author));
  }

regds,
hitesh.
s/w consultant,
Tata Infotech Ltd.
mob: 919892678844.
  ----- Original Message ----- 
  From: Farnaz Fotrousi 
  To: opencms 
  Sent: Tuesday, October 05, 2004 5:56 PM
  Subject: [opencms-dev] Results in lucene module


  Hi,

  I am using lucene 1.2 module for search in opencms5.1 . "simple_search.jsp" was the file that I used for doing simple search in that module. I can see search results successfully. but the title of any result is "untitled" and description is "null" but I can see "last_modified" in result's list and link to that resource works properly.
  Can any one help me what is happened? 

  Also I need to do advanced search by combination of some words. Does some one have example for advanced search?

  Best Regards,
  Farnaz


------------------------------------------------------------------------------
  Do you Yahoo!?
  vote.yahoo.com - Register online to vote today!


------------------------------------------------------------------------------




  _______________________________________________
  This mail is send to you from the opencms-dev mailing list
  To change your list options, or to unsubscribe from the list, please visit
  http://mail.opencms.org/mailman/listinfo/opencms-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20041005/98148d0d/attachment.htm>


More information about the opencms-dev mailing list