jDiction Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

jDiction 2.2.0 released. http://jdiction.org/downloads

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Finarfin

Pages: 1 [2] 3 4 5
16
Install & Configure jDiction / Re: Searching with finder
« on: July 13, 2013, 09:32:45 pm »
Well, I could clean the code so I´ll try to compilate:


  • Bug, unresolved: Triying to execute the indexer from console will fail to load Jdiction, so it won´t translate properly the entries.
  • jdcontent.php
    • Line 287,

      $params = $obj->params;

      will generate notice or warnings, I have added a check here

      if (isset($obj)) { $params = $obj->params }
    • Line 366, there are two problematic lines

      if (strpos($item->route, 'Itemid'))

      but as long as I could recall, this comparison leave out a lot of entries. And this comparisons aren´t on the original content.php. I have changed them Itemid with id, but I guess that even this comparison is meaningless and unnecesary
    • Line 450, function getListQuery

      I have added this line before returning the query

      $sql->order("a.id");

      I don´t know why, but when I was doing the queries it returns me something like

      id 21
      id 22
      id 23
      id 18, this one entry is out of order, something that really doesn´t have to affect the results, but it seemed to do...
  • adapter.php
    • I´m going to keep my adapter version. I have being tracing my solution and is not efficient (it will reindex several times the same item), but it gets the job done. I have tried your onBuildIndex but doesn´t work, I think that is because of the way it calculates the limit. I would like to do more test and let you know but I´m near production and this is currently working :D:D
    • Line 90, getItems function,

      $db = JFactory::getDbo()

      or

      use $this->db
      ?
    • Line 113, the solution I´m using

      setQuery($query, $offset/count($languages), $limit)

      instead of
      setQuery($query, $offset, $limit)

      the other posibility would be override onBuildIndex, but I don´t have the time to do the proper tests and this is working now :P
    • Add the getContentCount function we said before
  • jddatabase.php
    • method_exists(parent, )
      is wrong, the proper method to avoid notices is
      method_exists(get_parent_class($this), )

      There is at least two of this method_exists(parent). I could solve one, but the other one seems to break with the change.
  • Unresolved bug, probably nothing related to jdiction: When the indexer tries to optimize a big table like the one generated, it breaks.


17
Install & Configure jDiction / Re: Searching with finder
« on: July 13, 2013, 03:18:04 pm »
Totalitems is not correctly calculated. You calculate totalitems before with the new getTotalCount.

I mean, getItems select 20 rows but return 40 items because of jdiction. Then, you increase the offset by 20 (ok), but reduce the totalItems by 20 (false, you´ll to do here totalitems -= count(items)

I´m going to keep yet the offset/count(languages) inside getItems. YOu know, is magic, dont touch it :D



In another topic, I don´t want to think too much if there would be problems if you have enough articles with languages differents than '*' :P

18
Install & Configure jDiction / Re: Searching with finder
« on: July 12, 2013, 09:03:17 pm »
Almost perfect :D

Two points


Why the if ($query instanceof JDatabaseQuery) ? I don´t know why, but with that if it calls the parent and so give the bad number. I don´t know why is that the check, but I disable it for testing and worked. Perfectly! :O

Another topic, I guess that this

    $querylang = clone($query);
    // Get the total number of content items translated languages to index.
    $querylang->where('a.language = '.$this->db->q('*'));
    $this->db->setQuery($querylang);
    $return += ((int) $this->db->loadResult() * count($languages));

have to be inside the if (array_key_exists('language', $columns)) {, but is a not really a big deal.




Another thing

Inside the getItems, you have to divide the offset between count(languages). Why? Because you are returning count(language)*number of items, but the table you are visiting is not queried as fast.

Example

Offset = 0
Limit = 60

getItems()
- select from 0 to 60 (for jdiction I will get 180)

Offset = 180
Limit = 60

here, if I do the select from 180 with a 60 limit, I´m leaving behind the entries between 60 and 180 so... I have to divide.

And that´s all for today. I want to clean my code, maybe do some tests more and I´ll be able to try to compilate the patches done so you have them available.

Regards and thanks for your help, that last function, saved me :P

19
Install & Configure jDiction / Re: Searching with finder
« on: July 12, 2013, 05:37:50 pm »
Sorry, you are right, It will have problems only if you have articles with language different than "*"

20
Install & Configure jDiction / Re: Searching with finder
« on: July 12, 2013, 04:29:45 pm »
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 :)

21
Install & Configure jDiction / Re: Searching with finder
« on: July 12, 2013, 03:39:34 pm »
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)

22
Install & Configure jDiction / Re: Searching with finder
« on: July 12, 2013, 02:18:44 pm »
New info

Almost 99% sure that (one) of the problems come with the getContentCount. The jdiction adapter needs a implementation of this method that takes into account the jdiction idiosincracy :P If I use the default one, I don´t get errors, but it lacks entries. If I use that number multiplied (by 2, by 3, as a guess of the real number), I get more and more until it breaks. So... the solution would be implementing a getContentCount that do something like "for each query, add the count to the total"


23
Install & Configure jDiction / Re: Searching with finder
« on: July 11, 2013, 08:51:04 pm »
I continue working on this. Now it seems that its not translating when inside de jdcontent.php. I mean, it generate several items for each entry, but they have the same content. And just as Im writing this I realize one possible problem. I almost always do the tests fom console, and that´s why is not translating. I mean, it probably don´t load properly jdiction (a quick test seems to confirm this)

I´m still suffering the bug where indexing trough the interface enters an infinite loop, and I have added a getCount to the adapter that is a patch (the original getCount won´t work properly, we execute each query several times so I´m multipliying for now)

If you could share some input on this I would be happy

24
Install & Configure jDiction / Re: Searching with finder
« on: July 10, 2013, 07:58:13 pm »
Commenting the line 370 provoques an memory limit overflow. Maybe I borked something on another place. A question related with this line, why did you search  for ItemID? why not id?

25
Not going to worry about this :P I have disabled the edit button when the language is not the original one (a check in the template)

I´m more worried about the finder issue  ;D

26
Could you try to replicate this?


Initial status:
Original article, all languages, written in english
Translated in deutch


Go to article on deutch, on frontend
Save
The original is now in deutch.

27
Install & Configure jDiction / Re: Searching with finder
« on: July 09, 2013, 11:57:19 am »
Ok, I have news :D

Do you know when trying to find a bug you find like three more? :D well, there I am :)

About the finder, I have found three different possibilities that affect the results. I don´t know for sure how much affect each one until I make more tests but I´ll like to share what I found
  • Another extension, virtual domains, could be interfering in the results because of the access levels.
  • The offsett and batchsizes are calculated wrong when you do the Select * from content limit offset,batchsize, so you skip results
  • And the most important now, on jdcontent, the return on line 370 is leaving out a lot of urls. For testing, I have simply commented it to see the results and they are starting to appear. I still have to understand the consequences of that, but Im on my way :D

So, that´s how I´m doing. I have to do more test and backtrack my changes, but I´m near, I feel it... :P

28
Changing the one on line 88 seems to generate differents error. It seems that it didn´t enter there before

29
Install & Configure jDiction / Re: Searching with finder
« on: July 07, 2013, 01:41:10 pm »
Do you have some idea of how to attack the problem?

30
Sorry, I didn´t explain properly the point :D

Arount 101 on jddatabase.php, you´ll get the error "Notice: Use of undefined constant parent - assumed 'parent' in jddatabase:101"

You have a function there that says (method_exists(parent, '__wakeup'), that generates the notice.

The example I gave you is the solution for a really similar problem, but not the same (he was calling a function called __construct, yours is __wakeup). Apart from that , is the same problem :P

Pages: 1 [2] 3 4 5