This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

sfLucene and NO culture

Questions relating to sfLucenePlugin, sfSearch etc

sfLucene and NO culture

by skywalker » Fri Sep 18, 2009 4:14 pm

Seems like configuring sfLucene for norwegian culture is a pain in the... you know ;)~ ;-)~ :wink:

I have managed to generate the search index. But when trying to do a search, the application fail with an error message saying:
Code: Select all
[sfLuceneException]
Culture "no" is not enabled.


And the documentation say:
Code: Select all
(If you receive an exception saying "Culture XXX is not enabled" then define the culture even if you do not use i18n.)


just wonder... how do I define a culture? The symfony documentation say nothing about how to do it (AFAIK).
May the source be with you
User avatar
skywalker
Faithful Member
 
Posts: 337
Joined: Fri Mar 07, 2008 4:31 pm
Location: Norway

Re: sfLucene and NO culture

by skywalker » Mon Sep 28, 2009 9:14 am

No one that can help me with this? :(~ :-(~ :sad:
May the source be with you
User avatar
skywalker
Faithful Member
 
Posts: 337
Joined: Fri Mar 07, 2008 4:31 pm
Location: Norway

Re: sfLucene and NO culture

by skywalker » Tue Sep 29, 2009 1:36 pm

Seems like noone has tried to get the sfLucene plugin to work in a norwegian language culture... :(~ :-(~ :sad:

I have used several hours trying to find out how to make it work with language set to NO (for Norwegian) without luck...

So I guess that sfLucene does *NOT* work with NO culture...?
May the source be with you
User avatar
skywalker
Faithful Member
 
Posts: 337
Joined: Fri Mar 07, 2008 4:31 pm
Location: Norway

Re: sfLucene and NO culture

by skywalker » Wed Oct 07, 2009 10:17 am

Final call for help!.

I'm still trying to get sfLucene to work when culture is set to NO.

the application config/search.yml file looks like this:
Code: Select all
 
AppIndex:
  models:
    <model description removed>
 
  index:
    encoding: UTF-8
    cultures: NO
[CODE]
 
Then I added some debug code to the file plugins/sfLucenePlugin/lib/sfLucene.class.php:
[code]
protected function loadConfig()
{
  $config = self::getConfig();
  if (!isset($config[$this->name])) {
    return false;
  }
  echo '<pre>'; var_dump($config); die;
[/code]
 
When the cultures is set to NO, the dump of $config shows that the culturs array is false:
[code]
  ["index"]=>
  array(8) {
    ["encoding"]=>
    string(5) "utf-8"
    ["cultures"]=>
    bool(false)
[/code]
 
If I change the culture in the search.yml file to "EN, FR" (just an example), the cultures array in $config is set to "EN, FR".
[code]
  ["index"]=>
  array(8) {
    ["encoding"]=>
    string(5) "utf-8"
    ["cultures"]=>
    string(6) "EN, FR"


Can someone please explain why?
May the source be with you
User avatar
skywalker
Faithful Member
 
Posts: 337
Joined: Fri Mar 07, 2008 4:31 pm
Location: Norway

Re: sfLucene and NO culture

by skywalker » Wed Oct 07, 2009 10:21 am

Hehe... I know why. The culture string NO is parsed as no (in opposite to yes)...

Single- or double-quoting the word does not help. It is stilled parsed as no.

So it seems like the yml parser is messing things up, or?
May the source be with you
User avatar
skywalker
Faithful Member
 
Posts: 337
Joined: Fri Mar 07, 2008 4:31 pm
Location: Norway

Re: sfLucene and NO culture

by halfer » Sun Oct 18, 2009 11:45 am

Hi skywalker. I would have thought there would be a way to escape the 'no' value - not sure how though! Perhaps try switching to a different YAML parser? If you are stuck on this, however, try dropping a line to the sfLucene maintainer. When I did so (about a year ago) they were very helpful indeed in tracking down a rare bug.
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: sfLucene and NO culture

by skywalker » Mon Oct 19, 2009 9:48 am

Thanks for your reply. I had to do some trick in the myUser class too. After spending several hours on this issue I got it working - at last.

And yes. 'no' has to be quoted.
May the source be with you
User avatar
skywalker
Faithful Member
 
Posts: 337
Joined: Fri Mar 07, 2008 4:31 pm
Location: Norway