English > Install & Configure jDiction

Searching with finder

<< < (5/7) > >>

Harald Leithner:
please add this function to lib/jdiction/finder/adapter.php


--- Code: ---  /**
   * Method to get the number of content items available to index.
   *
   * @return  integer  The number of content items available to index.
   *
   * @since   2.5
   * @throws  Exception on database error.
   */
  protected function getContentCount() {
    $return = parent::getContentCount();

    $jDiction = jDiction::getInstance();
    $languages = $jDiction->getLanguages(true);
   
    $return = $return * $languages;
   
    return $return;
  }
--- End code ---

hopefully this fixes the problem.

Finarfin:
It won´t :P If you return more items that it have, it breaks :D You have to return exactly or less. If more it will be a infinite loop (but you´ll be able to close it manually if you realize this)

Harald Leithner:
Hmm it should not return more then it have.

getItems is doing the same, it takes the items and use each language for each row and return the result.

maybe it returns too many items because it doesn't really honor the $limit parameter.

You have to trace this because I don't have the time at the moment.

Finarfin:
The fact is that the getContentCount have to be like this:


foreach language
total += getContentCount

and not

getContentCount * count(language)

What is the difference? That if I have a mix of translated and not translated articles, I will get different numbers for each getContentCount, depending of wich language I´m looking. Yes, the limit variable is working properly... except on the last iterations where I could get less.

english entry 1, translated to spanish
english entry 2, non translated

How many items I have to insert? not 4 (getcount * 2) but 3 (getcount with english + getcount with spanish)

I´ll let you know if I implement something that I can share :)

Harald Leithner:
thats not correct

if your article is language * it will translated to english while indexing, one problem could be with articles that have a language set...

because jdiction adds this where statement:


--- Code: ---$query->where('a.language in ('.$db->q('*').','.$db->q($language).')');
--- End code ---

if we would only use


--- Code: ---$query->where('a.language in ('.$db->q('*').')');
--- End code ---

it should work, but misses articles in only one language.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version