marklogic-samplestack icon indicating copy to clipboard operation
marklogic-samplestack copied to clipboard

Tags endpoint: Tags count incorrect

Open wooldridge opened this issue 10 years ago • 14 comments

I believe the /v1/tags endpoint is returning the incorrect total number of tags in its responses.

To reproduce:

View More Tags dialog, NOT LOGGED IN, app makes call to endpoint:

search.pageLength = 18
search.sort = 'frequency'
search.start = 1

Result is...

aggregate-result[0]['count'] = 5157 distinct-value = array of 18 objects with _value ('javascript') and frequency (1041)

18 tags displayed per page, so 5157/18 = expect 287 pages to display

(This is what we expect and display in pagination component.)

In reality, can only go to page 51, after that no tags come back from endpoint.

search.pageLength = 18
search.sort = 'frequency'
search.start = 901

last page has 7 results so…

(18 * 50) + 7 = 907 actual results are available, not 5157

wooldridge avatar Jan 23 '15 19:01 wooldridge

Chatted with @grechaw a bit and it turns out this value:

aggregate-result[0]['count']

Is not the total number of tags in the results set, but rather is the sum of all the frequency values for all the tags in the result set.

We need the total number of tags in the results set for pagination. @grechaw is looking into how to offer this.

wooldridge avatar Jan 23 '15 19:01 wooldridge

Take this as a bug to be worked going forward.

popzip avatar Jan 23 '15 21:01 popzip

When we discovered that there's no overt error in this behavior and pushed it, it seems the 'critical' flag is a bit extreme. We also don't know what to do about this bug.

grechaw avatar Jan 26 '15 18:01 grechaw

This is one of the higher priority bugs for 8.0-2. Let me know if not feasible.

popzip avatar Feb 20 '15 21:02 popzip

We at least need a workaround for this one, and should probably file an RFE as well. One proposal is to suppress 'Last' button.

popzip avatar Feb 24 '15 19:02 popzip

I think suppressing the 'last' button is a good idea -- requires no middle tier action, I don't think. Not sure what to do with this issue -- move to RFE and N/A or backlog?

grechaw avatar Feb 24 '15 20:02 grechaw

Leave as bug for now to track: decision for workaround and the effort to implement the workaround.

What about filing an RFE on the APIs for this limitation?

popzip avatar Feb 24 '15 20:02 popzip

I think our bug is not having a document model that is consistent with the Samplestack specs given what's available in the server. I think the RFE for the server, if there is to be one, is to make it possible to do what we need to do even if we (or the next customer who faces this particular issue) want to stick with the embedded array design of the doc model.

It would seem to me that, theoretically, we could also consider a custom extension which would allow the correct functionality to be delivered reasonably efficiently by at least keeping the code and data on the E-node(s).

laurelnaiad avatar Feb 24 '15 21:02 laurelnaiad

As we were discussing this the other day it did ocur to me that if there were simply a document per tag, we could indeed implement this count. There's just another kind of document that would have to be introduced. A medium LOE - 3-4 days I'd say off the cuff.

grechaw avatar Feb 26 '15 05:02 grechaw

This may be a duplicate, but any workaround for this is in the browser now -- further work could be done with a revamping of the data model.

grechaw avatar Mar 10 '15 16:03 grechaw

If we could do the browser workaround of suppressing the last page option in the tag browser that would be great.

popzip avatar Mar 10 '15 17:03 popzip

Let's leave this issue here as is for when we actually fix the issue, I've opened #602 to implement a workaround for 1.1.0.

laurelnaiad avatar Mar 10 '15 17:03 laurelnaiad

Ok thanks that makes sense.

popzip avatar Mar 10 '15 17:03 popzip

This works in the node-middle tier now.

laurelnaiad avatar Apr 03 '15 17:04 laurelnaiad