Hi, i created a profile "No Decay" and a field "product orders" to save the total orders of each product variant in my Drupal Commerce project.
The field is also integrated with the module "Commerce Product Popularity".
I'm trying to use the field as a sort by "Bestsellers" in my search created with search_api + search_api_db + search_api_sorts.
But the field is not displayed in the list of fields available to use as a sort option.
I created a issue in the search_api_sorts module, and the maintainer said "It seems that your value may be natively Fulltext, so you can't use that for sorting."
Look: http://drupal.org/node/1728378
This is the problem? Can we solve this?
Thank you!
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedI cannot reproduce this. I installed radioactivity, setup a basic profile for a node, and indexed with Search API as 'Decimal'. I can see it normally as a Sort option.
By the way, the Radioactivity field is not very useful for Search API: you would need to re-index the node EVERY time the radio-activity changes. Search API will not know when Radioactivity has changed, until it re-indexes all those nodes. So whenever radioactivity changes, you need to add a hook to update the {search_api_item} table... Which is probably very resource intensive on large sites with a lot of radioactive nodes, you won't be able to use it.
Comment #2
brunorios1 CreditAttribution: brunorios1 commented@morningtime,
you tested with drupal commerce?
you created the field in the product variant (entity) or in the product display (node)?
here don't worked with the product variant (entity) but worked with the product display (node).
thank you!
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedOk, no I didn't use the Commerce module...
Comment #4
brunorios1 CreditAttribution: brunorios1 commentedok, i'll try to reproduce in a clean installation and bring more info...
Comment #5
brunorios1 CreditAttribution: brunorios1 commented@morningtime, you said about the re-index EVERY time the radio-activity changes...
you know of any solution to use with search_api that consumes less resources than Radioactivity + search_api?
thanks!
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedYou could use Search API and do a custom hook_cron() function to tell Search API to reindex all nodes, for example every 24hrs.
But if you need "live radioactivity" results, then you must use a regular View and query the Node fields directly.
Comment #7
brunorios1 CreditAttribution: brunorios1 commentedOk, not so bad...
I don't need so accurate statistics =)
And how can i tell Search API to reindex all nodes with code?
I'm not a coder, so where can i find documentation or a example?
Thank you very much.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedYou'll have to find a coder or pay someone to do it then.
Comment #9
brunorios1 CreditAttribution: brunorios1 commentedworked in a clean installation.
sorry for making you lose time!
thanks!
Comment #10
brunorios1 CreditAttribution: brunorios1 commentedi found the reason for the radioactivity field isn't being available for sort and reproduced in a clean installation.
- i have a product display (node)
-- a product reference field (unlimited values)
--- in the product (entity) referenced i have a radioactivity field (single value)
my product reference field accepts unlimited products entities - variations of colors, sizes, prices - and this is good =)
but this is causing the problem about the radioactivity field is not being sorted (note that this problem don't happen with the price field).
if i change the product reference field in the product display to a single value (this is bad), the radioactivity field appears in the sorts list.
any workaround?
ps.: multiple valued fields are not sortable by search_api_sorts. it seems that the radioactivity field is being considered multiple valued even being single valued.
thank you!
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedJust to be clear, it's not because of my extension, but because you can't sort on something that has multiple values, It's not possible in the whole universe.
Marbles
1 - Colors: #FFF, #BBB, #AAA
2 - Colors: #AAA, #999, #222
3 - Colors: #111, #333, EEE
How do you sort these marbles by "Color codes"? It's not possible to sort on multi-value fields, unless you calculate an Average or Mean value, or some single value describing the set.
Comment #12
brunorios1 CreditAttribution: brunorios1 commented@morningtime,
sure, my explanation was poorly expressed...
"multiple valued fields are not sortable" would be sufficient =)
sorry!
Comment #13
brunorios1 CreditAttribution: brunorios1 commentedComment #14
brunorios1 CreditAttribution: brunorios1 commentedComment #15
brunorios1 CreditAttribution: brunorios1 commentedduplicate of: http://drupal.org/node/1764510
Comment #16
elsteff1385 CreditAttribution: elsteff1385 commentedEasily fixed: put this in a custom module named "radioactivity_search_api_reindex"