Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-18-2007, 03:19 PM
Junior Member
 
Join Date: May 2007
Posts: 1
Default Checking for the existence of fields in using send search

deleted post deleted post

Last edited by codeCowboy : 11-02-2007 at 11:41 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-24-2007, 12:42 PM
Junior Member
 
Join Date: Jul 2007
Posts: 7
Default

Maybe it's a little late to answer your question. But could something like this:

<?php
if(in_array('afieldname',$result->getDocument()->getFieldNames()))
?>

It's a bit strange that there is no function to check wether a field exists or not...

Another solution is to catch the exception:
<?
$field = 'news_title';
try {
$result->$field;
} catch(Zend_Search_Lucene_Exception $e) {
switch($e->getMessage()) {
case 'Field name '.$field.' not found in document.' :
break;
}
}
?>

But i think that is really a nasty solution, they should have an Zend_Search_Lucene_Field_Exception with an code (example 10 means it not exists)..

Last edited by kees : 08-24-2007 at 12:47 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:01 PM.