This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » General plug-ins » [sfLucenePlugin] Field name "sfl_type" not found in document.
[sfLucenePlugin] Field name "sfl_type" not found in document. [message #41030] Thu, 06 December 2007 15:29 Go to next message
gunnar  is currently offline gunnar
Messages: 19
Registered: June 2007
Junior Member
Hi!

I get the following error at random locations:
Field name "sfl_type" not found in document.

It may appear on page two (or any other) of a list of search results, all from the same model. That gives me the impression that it should be related to neither the model/index or the search term.

Any ideas?
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41031 is a reply to message #41030 ] Thu, 06 December 2007 15:42 Go to previous messageGo to next message
Carl Vondrick  is currently offline Carl Vondrick
Messages: 211
Registered: August 2007
Faithful Member
Hi,
Can you give me a stack trace and your search.yml file?
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41032 is a reply to message #41031 ] Thu, 06 December 2007 15:45 Go to previous messageGo to next message
gunnar  is currently offline gunnar
Messages: 19
Registered: June 2007
Junior Member
OffersIndex:
  models:
    BgOffer:
      fields:
        id: unindexed
        title:
          boost: 1.5
          type:  text
        shortDesc: text
        longDesc:
          type: text
          transform: strip_tags
        strippedTitle: text
        cityTag: text
        categories:
          boost: 2
          type:  text

  index:
    encoding: UTF-8

[Zend_Search_Lucene_Exception]
Field name "sfl_type" not found in document.
stack trace
at ()
in SF_ROOT_DIR\plugins\sfLucenePlugin\lib\vendor\Zend\Search\Lucene\Document.php line 94 ...
    public function getField($fieldName)

    {

        if (!array_key_exists($fieldName, $this->_fields)) {

            throw new Zend_Search_Lucene_Exception("Field name \"$fieldName\" not found in document.");

        }

        return $this->_fields[$fieldName];

    }
at Zend_Search_Lucene_Document->getField('sfl_type')
in SF_ROOT_DIR\plugins\sfLucenePlugin\lib\vendor\Zend\Search\Lucene\Document.php line 108 ...
at Zend_Search_Lucene_Document->getFieldValue('sfl_type')
in SF_ROOT_DIR\plugins\sfLucenePlugin\lib\vendor\Zend\Search\Lucene\Search\QueryHit.php line 79 ...
at Zend_Search_Lucene_Search_QueryHit->__get('sfl_type')
in SF_ROOT_DIR\plugins\sfLucenePlugin\lib\results\sfLuceneResult.class.php line 49 ...
at sfLuceneResult::getInstance(object('Zend_Search_Lucene_Search_QueryHit'), object('sfLucene'))
in SF_ROOT_DIR\plugins\sfLucenePlugin\lib\results\sfLuceneResults.class.php line 42 ...
at sfLuceneResults->getInstance(object('Zend_Search_Lucene_Search_QueryHit'))
in SF_ROOT_DIR\plugins\sfLucenePlugin\lib\results\sfLuceneResults.class.php line 60 ...
at sfLuceneResults->current()
in SF_ROOT_DIR\plugins\sfLucenePlugin\modules\sfLucene\templates\searchResults.php line 16 ...
at require('D:\Apache\htdocs\sp_symfony\plugins\sfLucenePlugin\modules\sfLucene\templates\searchResults.php')
in SF_SYMFONY_LIB_DIR\view\sfPHPView.class.php line 114 ...
at sfPHPView->renderFile('D:\Apache\htdocs\sp_symfony\plugins/sfLucenePlugin/modules/sfLucene/templates/searchResults.php')
in SF_SYMFONY_LIB_DIR\view\sfPHPView.class.php line 251 ...
at sfPHPView->render()
in SF_SYMFONY_LIB_DIR\filter\sfExecutionFilter.class.php line 168 ...
at sfExecutionFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 43 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR\filter\sfFlashFilter.class.php line 50 ...
at sfFlashFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 43 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR\filter\sfCommonFilter.class.php line 29 ...
at sfCommonFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 43 ...
at sfFilterChain->execute()
in SF_ROOT_DIR\plugins\sfLucenePlugin\lib\filter\sfLuceneHighlightFilter.class.php line 29 ...
at sfLuceneHighlightFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 43 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR\filter\sfWebDebugFilter.class.php line 35 ...
at sfWebDebugFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 43 ...
at sfFilterChain->execute()
in SF_ROOT_DIR\plugins\sfUrchinPlugin\lib\filter\sfUrchinFilter.php line 29 ...
at sfUrchinFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 43 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR\filter\sfRenderingFilter.class.php line 33 ...
at sfRenderingFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 43 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR\controller\sfController.class.php line 276 ...
at sfController->forward('sfLucene', 'search')
in SF_SYMFONY_LIB_DIR\controller\sfFrontWebController.class.php line 48 ...
at sfFrontWebController->dispatch()
in SF_ROOT_DIR\web\studplan_dev.php line 10 ...
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41067 is a reply to message #41032 ] Thu, 06 December 2007 22:54 Go to previous messageGo to next message
Carl Vondrick  is currently offline Carl Vondrick
Messages: 211
Registered: August 2007
Faithful Member
What version of sfLucene are you using? Make sure you are using the latest release (0.1.2 beta).
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41068 is a reply to message #41067 ] Thu, 06 December 2007 23:00 Go to previous messageGo to next message
gunnar  is currently offline gunnar
Messages: 19
Registered: June 2007
Junior Member
I am using the latest version.

I think I have narrowed it down to problems related to unexpected characters in some of the indexed fields, probably related to an unfortunate mix of utf-8 and latin1 combinded with Norwegian letters (øæå). When I replace them using htmlentities(), it seems to work fine. Not sure if this is actually a bug or not.
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41077 is a reply to message #41068 ] Fri, 07 December 2007 01:22 Go to previous messageGo to next message
Carl Vondrick  is currently offline Carl Vondrick
Messages: 211
Registered: August 2007
Faithful Member
Hey,
Glad you figured out a work-around. I'll run some tests to see if this is an error. In either case, it should fall back gracefully.
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41104 is a reply to message #41077 ] Fri, 07 December 2007 10:33 Go to previous messageGo to next message
gunnar  is currently offline gunnar
Messages: 19
Registered: June 2007
Junior Member
I think it's still not quite working. As far as I can tell, the indexer now stores the encoded values as entity references, which means that when I search for elements containing these letters, no results are returned.

Can you define custom transformation functions? For example running html_entity_decode with certain parameters, or even wrapping several function in one user function, i.e. prepare_for_indexing()?
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41182 is a reply to message #41104 ] Sat, 08 December 2007 05:35 Go to previous messageGo to next message
Carl Vondrick  is currently offline Carl Vondrick
Messages: 211
Registered: August 2007
Faithful Member
Yes, you can define your own transformations. Per the documentation:

Quote:

Further, you can specify a transformation function to put the value through before it is indexed. This is useful if you have HTML code being returned and you need strip it out. Define this like so:
MyIndex:
  models:
    BlogPost:
      fields:
        title: text
        content:
          type: text
          transform: strip_tags
          boost: 1.5

When this model is indexed, the content field will be automatically routed through strip_tags() before being stored in the index.
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41188 is a reply to message #41182 ] Sat, 08 December 2007 13:37 Go to previous messageGo to next message
gunnar  is currently offline gunnar
Messages: 19
Registered: June 2007
Junior Member
I'm aware of this. My question was wether you can pass the functions arguements, or use other functions than the ones built into php.
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #41209 is a reply to message #41188 ] Sat, 08 December 2007 22:49 Go to previous messageGo to next message
Carl Vondrick  is currently offline Carl Vondrick
Messages: 211
Registered: August 2007
Faithful Member
Oh, sorry for misunderstanding you. No, this is not possible right now and I'm not sure if it will be possible in the future.

I think there has to be a better way. I noticed that you are not using the utf8 analyzer, which may be your problem. Try configuring sfLucene like:

index:
  encoding: utf8
  analyzer: utf8num


If you require it to be case insensitive:
index:
  encoding: utf8
  analyzer: utf8num
  case_sensitive: on
  mb_string: on
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #52293 is a reply to message #41030 ] Mon, 19 May 2008 16:17 Go to previous messageGo to next message
onanga  is currently offline onanga
Messages: 66
Registered: October 2006
Location: France
Member
Hello,

Maybe you tried to apply search elements that do not have the fields you specified in the objects directly ?
Maybe is it through i18n ?

Try to make sure you do have the fields in your bgOffer object, otherwise, implement them Wink


Card
Particules, Blog
Re: [sfLucenePlugin] Field name "sfl_type" not found in document. [message #102032 is a reply to message #52293 ] Tue, 06 July 2010 00:04 Go to previous message
vrtigo  is currently offline vrtigo
Messages: 6
Registered: February 2010
Junior Member
onanga wrote on Mon, 19 May 2008 16:17

Hello,

Maybe you tried to apply search elements that do not have the fields you specified in the objects directly ?
Maybe is it through i18n ?

Try to make sure you do have the fields in your bgOffer object, otherwise, implement them Wink


What fields, sfl_type? Do you mean implement them in my schema? If so, what values can it hold?

Im getting the sfl_type not found in document error when i search for any term that is indexed in a document. Searching for a non existent term works, albeit with no results. Heres my project search.yml

cms_search:
  models:
    pfCMSPage:
      fields:
        id: unindexed
        title:
          boost: 1.5
          type: text
        content:
          type: text
          transform: strip_tags
      #route: page/index?slug=%slug%

  index:
    encoding: UTF-8
    analyzer: utf8num
    case_sensitive: off
    mb_string: on


I have the following in one of my models that gets run when a page is published:

public function updateLuceneIndex()
{
  $index = pfCMSPagePublishedPeer::getLuceneIndex();

  // remove existing entries
  foreach ($index->find('pk:'.$this->getId()) as $hit)
  {
    $index->delete($hit->id);
  }

  // don't index expired and non-activated jobs
  if ($this->getIsHidden() && !$this->getIsNavigationItemOnly())
  {
    return;
  }

  $doc = new Zend_Search_Lucene_Document();

  // store job primary key to identify it in the search results
  $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', $this->getId()));

  // index job fields
  $doc->addField(Zend_Search_Lucene_Field::UnStored('title', $this->getTitle(), 'utf-8'));
  $doc->addField(Zend_Search_Lucene_Field::UnStored('content', $this->getContent().$this->getAdditionalContent(), 'utf-8'));

  // add job to the index
  $index->addDocument($doc);
  $index->commit();
}


./symfony lucene:about appname shows 3 documents, and luke shows the details of the documents ok, so the index is fine - its just when the plugin tries to search the index that it breaks.

This is doing my head in. Any ideas?

FYI I am using Symfony 1.2.12, and sfLucene 0.2-DEV

[Updated on: Tue, 06 July 2010 00:06]

Previous Topic:SfEasyGmapPlugin and displaying coordinates of a click on a map.
Next Topic:What query method for sfPropel15Plugin is equal to Peer's doSelectWithI18n?
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software