ì´ íì´ì§ì ë²ìì ìë£ëì§ ìììµëë¤.
ê³ ê¸ ë±ê¸ íì´ì§
- ê°ì
- ì´ íì´ì§ë¥¼ ì¬ì©íì¬ í¸ë커 í목 í¹ì ìí¤ íì´ì§ë¥¼ íê°í기 ìí "ë±ê¸" ìì¤í
ì 구ì±íììì¤.
- ì ê·¼íë ¤ë©´
- ê´ë¦¬ í¨ë ìì ë±ê¸ ìì´ì½
ì í´ë¦íììì¤
ëë http://ê·íëë©ì¸ì£¼ì.com/tiki-admin.php?page=rating ì¼ë¡ ì ê·¼íììì¤
- 주ì
- í°í¤ë íì¬ ê³ ê¸ ë±ê¸ì íµíì¬ ë¶ë¥íë ê²ì ë¤ìì 기ë¥ë¤ìì ì§ìí©ëë¤:
ëí ìíì ì°ì° í¸ë커 íë 를 참조íììì¤
ì¤ì |
ì¤ëª
|
Default |
ì ì êµ¬ì± |
|
|
ê³ ê¸ ë±ê¸ |
ë´ë¶ ë±ê¸ ìì¤í
ì íì±íí¨, ì´ë í¸ë커, ê¸°ì¬ í¹ì 기í 기ë¥ììì ê°ë¤ì ê³ì°íëë° ì¬ì©ë¨. |
|
ë±ê¸ ì¬ê³ì° 모ë: |
ë±ê¸ í©ê³ê° ì¸ì ê·¸ë¦¬ê³ ì´ë»ê² ì¬ê³ì°ëëì§ë¥¼ ê²°ì : * í¬í ì (기본ê°): í¬íê° ìíë ë 매ë²ë§ë¤ ê°ì²´ì ëí ì ìê° ì¬ê³ì°ëì´ì¼í¨ì ì§ì . ì´ ì íì¬íì ê·ëª¨ê° ë ì ì ì¬ì´í¸ ë° ë±ê¸ì´ ì¬ì©ë ë ë¹êµì ë¨ìí ì°ì° ë°©ìì ì ì í¨. * ë¡ë ì 무ìì: ì´ë 무ìì 기ë°ì¼ë¡ íì´ì§ ë¡ë ìì ì¼ë¶ ììì ì ìë¤ì´ ê³ì°ëëë¡ will cause a few scores to be calculates on page load on a random basis (odds and count can be configured to adapt to site load). This option is suitable for calculation rules involving time that must be recalculated even if no new votes occurred. * Random on vote is similar to random on load, but will recalculate multiple scores (not necessarily including the current object) when a vote is performed. It is suitable for similar situations. The best option will depend on site load. * Periodic: is the best option for heavy load sites, making sure all calculations are done outside the web requests. A cron job must be set-up manually by the site's administrator. A sample script is available at the end of this page. Depending on the site load, some options may be better than others; on large volume sites, we recommend cron job. The Recalculate on vote recalculation may be inaccurate if rating calculation depends time. Before any attempt to re-index the object: Ties into the Search and List from Unified Index and updates the calculation at index-time. |
Recalculate on vote |
Recalculation odds (1 in X): |
|
|
Recalculation count: |
|
|
Wiki |
|
|
Simple wiki ratings |
Enable a simple rating bar at the top of each wiki page. |
|
Wiki rating options: |
List of options for the simple wiki ratings. |
1,2,3,4,5 |
Articles |
Enable a simple rating bar at the top of each articles page. |
|
User ratings on articles |
|
|
Article rating options: |
|
|
Unable to load the jQuery Sortable Tables feature.
The feature must first be enabled through this same administration panel. Along with the feature, a few options are available. Among them, the score recalculation period must be defined. These are the available options:
- On vote (default) indicates that the score for the object should be recalculated every time a vote is performed. This option is suitable for sites with lower volumes and relatively simple calculation methods when ratings are used.
- Random on load will cause a few scores to be calculates on page load on a random basis (odds and count can be configured to adapt to site load). This option is suitable for calculation rules involving time that must be recalculated even if no new votes occurred.
- Random on vote is similar to random on load, but will recalculate multiple scores (not necessarily including the current object) when a vote is performed. It is suitable for similar situations. The best option will depend on site load.
- Periodic is the best option for heavy load sites, making sure all calculations are done outside the web requests. A cron job must be set-up manually by the site's administrator. A sample script is available at the end of this page.
For the random options, the odds of recalculating must be specified as a dice roll. For each occurrence of a recalculation, a limit to how many scores can be calculated must be specified to avoid the hang-up effect on the page load.
The value ranges for each object type can also be specified through the administration panels.
The common sort_mode parameter to lists can be used to activate sorting using advanced ratings. To do so, the sort mode must be set to adv_rating_X_asc or adv_rating_X_desc where X is the ID of the rating configuration. The default sort can also be set to advanced ratings in the administration panel where applicable.
Calculation configuration
From the administration panel, new calculations can be added. Initially, only the name is required. When created, the calculation will contain suitable default values.
For wiki pages:
Thus, visitors can provide feedback like:
- Did this page help you solve the issue?
- Was this page easy to understand?
Advanced Rating
Introduced in Tiki5, the advanced rating feature allows for more control over the aggregation of scores.
Rating methods are defined globally and will be used for all supported objects. They are defined through the Advanced Rating administration panel (tiki-admin.php?page=rating). Multiple methods can be created. If a method contains type-specific calculations, it will be ignored when performing the calculation.
Features currently supporting sorting through advanced rating:
Sorting items according to advanced rating
Note that the sort mode to use when needing to sort by advanced rating is either adv_rating_xx_asc or adv_rating_xx_desc, where xx is the ratingConfigId.
Feature request: Can we make this take the name of the config instead of the ratingConfigId as well?
Set-up
By default, each calculated value is kept for 1 hour (3600 seconds). This limit does not apply when recalculating on vote, but is used for every other technique to avoid recalculating the same scores over and over again.
The calculation is defined as a small piece of code, similar to functional languages, which is very close to mathematical representations. Creating custom formulas is expected to require some mathematical skills. However, this documentation should provide examples for most frequent cases.
The editor in the administration panel performs extensive validation and will make it impossible to save the formula unless it can be evaluated. Checks are performed for:
- Syntax errors
- Unknown functions
- Missing arguments
- Invalid argument values
- Unknown input variables
Default formula Copy to clipboard (rating-average (object type object-id))
It can be altered to limit the vote consideration to a limited time span, 30 days for example.
Recent votes only Copy to clipboard (rating-average
(object type object-id)
(range (mul 3600 24 30))
)
In the language, spaces do not matter. Only the parenthesis indicate structure. rating-average is a function that fetches the ratings for a given object. type and object-id are standard variables fed when calculating a rating. object and range are configuration options of the function.
mul is a mathematical function. (mul 3600 24 30) is equivalent to 3600*24*30.
The functions can be combined in various ways. For example, we could calculate a score that considers the votes from the past month, but gives extra emphasis on the recent ones.
Combined vote duration Copy to clipboard (add
(rating-average
(object type object-id)
(range (mul 3600 24 30)))
(rating-average
(object type object-id)
(range (mul 3600 24 7)))
)
Even though the votes are 1-5, the final score can be on an entirely different scale. The language is also extensible if the calculation needs to be combined with other factors or weight. See Rating Language.
All available options are documented in the following section.
General Reference
Any comment block is stripped from the formula at parse-time
Examples Copy to clipboard (mul
1
2
(comment Simple enough?))
-> 2
mul (Multiply)
Performs a simple multiplication accepting multiple input values.
Examples Copy to clipboard (mul 3 4)
-> 12
(mul (mul 3 4) 5)
-> 60
(mul 3 4 5)
-> 60
(mul 4 0.5)
-> 2
div (Divide)
Performs a simple division accepting multiple input values.
Examples Copy to clipboard (div 3 4)
-> 0.75
(div (mul 3 10) 5)
-> 6
(div 30 5 3)
-> 2
(div 4 0.5)
-> 8
add (Sum)
Performs a simple sum accepting multiple input
Examples Copy to clipboard (add 3 4)
-> 7
(add (add 3 4) 5)
-> 12
(add 3 4 5)
-> 12
(add 4 0.5)
-> 4.5
sub (Substract)
Performs a simple substraction accepting multiple input
Examples Copy to clipboard (sub 3 4)
-> -1
(sub (sub 3 4) 5)
-> -6
(sub 3 4 5)
-> -12
(add 4 0.5)
-> 3.5
round
Rounds to a specific number of digits (new in Tiki12)
Examples Copy to clipboard (round 4.556234342234 2)
-> 4.56
(round 4.556234342234)
-> 5
coalesce
Returns the first non-empty value from the list.
Examples Copy to clipboard (coalesce 3 4)
-> -3
(coalesce (sub 3 3) 5)
-> 5
(coalesce 0 0 (str) -10)
-> -10
(coalesce 0 0 0 0 0)
-> 0
str
Generates a static string when needed and the processor attempts to process the string as a variable. Any arguments will be concatenated using spaces.
Note: The quoted string syntax was included in Tiki13.
Examples Copy to clipboard (str hello-world)
-> "hello-world"
(str hello world)
-> "hello world"
(str
hello
world
foobar)
-> "hello world foobar"
(str (mul 2 3) "= 6")
-> "6 = 6"
concat
Concatenates a string of text. (new in Tiki12)
Note: The quoted string syntax was included in Tiki13.
Examples Copy to clipboard (concat
(str $)
1234
)
-> "$1234"
(concat
14
(str %)
)
-> "14%"
(concat 14 "%")
-> "14%"
map
Generates a map (or dictionary).
Examples Copy to clipboard (map
(key1 1)
(key2 2)
(key3 (str value3))
)
-> {"key1": 1, "key2": 2, "key3": "value3"}
equals
Compares multiple values.
Examples Copy to clipboard (equals 2 (add 1 1) (sub 4 2))
-> 1 (equivalent of 2 == 1+1 && 2 == 4-2)
(equals (add 1 1) 3)
-> 0
if
Conditionally evaluates a branch.
Examples Copy to clipboard (if (equals 2 2) 42 -1)
-> 42
(if (equals 2 1) 42 -1)
-> -1
and
Ensures all elements evaluate to true.
Examples Copy to clipboard (and 3 2 1 2 3)
-> 1
(and 2 3 0 2)
-> 0
or
Ensures that at least one element evaluates to true. Elements are evauated sequentially until a false element is found. Others are left unevaluated.
Examples Copy to clipboard (or 3 2 1 2 3)
-> 1
(or 2 3 0 2)
-> 1
(or 0 0)
-> 0
hash
Generates a hash based on multiple values. Used primarily to generate aggregate hashes in the PluginActivityStream. Note that because it is a hash, the exact value coming out does not matter. Only that given the same parameter, it will produce the same value.
Examples Copy to clipboard (hash 1)
-> [sha1("1")]
(hash 1 2 3 4)
-> [sha1("1/2/3/4")]
(hash 1 2 (map (a 3) (b 4)))
-> [sha1("1/2/3/4")]
avg
Calculates the average of multiple values. All entries in the list will be flattened if arrays are present.
Examples Copy to clipboard (avg 1 2 3)
-> 2
... given list contains [1, 2, 3]
(avg list)
-> 2
split-list
Produces a multi-dimensional array out of a text string. Each line is expected to be an independent value, each line will be split by a separator into the specified keys.
Examples Copy to clipboard ... given str contains a list of 3 comma-separated values
(split-list
(content str)
(separator ,)
(keys a b c))
-> [{a: 1, b: 2, c: 3}, {a: 2, b: 3, c: 4}]
for-each
For a list of value pairs, such as the output of split-list, evaluates a formula for each set of values, returns the list of results.
Within the formula, variables coming from the list will be used first. Fallback will be on the other variables available in the execution context.
Examples Copy to clipboard ... given items contains [{a: 1, b: 2, c: 3}, {a: 2, b: 3, c: 4}]
(for-each
(list items)
(formula (mul a b c)))
-> [6, 24]
... given items contains [{a: 1, b: 2, c: 3}, {a: 2, b: 3, c: 4}]
... and d contains 10
(for-each
(list items)
(formula (mul c d)))
-> [30, 40]
ê³ ê¸ ë±ê¸-í¹ì 참조
rating-average (ë±ê¸-íê· ) ë° rating-sum (ë±ê¸ í©ê³)
ë±ê¸ í¨ìë ë±ê¸ ê¸°ë¡ í
ì´ë¸ìì ì ì를 ê³ì°í©ëë¤. ì¬ì´í¸ì ìíë ê° ë±ê¸ì ë°ì´í°ë² ì´ì¤ ë´ì ë³´ê´ëë©° ì¬ì©ì ì§ì ë±ê¸ì ê³ì°í기 ìí´ì ì¬ì©ë ì ììµëë¤. ë¤ìí ì íì¬íì´ ë¬¸ìì íì§ í¥ìì ì§ìíê±°ë í¼ë ìì§ê¸°ë¡ ë¤ì´ì¤ë ë°ì´í°ì ìì를 매기기 ìíë ë±ì ì¬ì´í¸ ìì ì¤ìì±ì ë°ìí기 ìíì¬ ì ì를 ê³ì°íëë¡ ì ì©ë©ëë¤.
- object (ê°ì²´), íìì´ë©° íì ì´ ë´ì©ì (ê°ì²´ ì í ê°ì²´ID).
- range (ë²ì), to limit how long votes are considered. Argument is provided as a number of seconds.
- ignore (무ì), with anonymous as an argument to only consider votes from registered users.
- keep (ì ì§), to only consider one vote per visitor. Unless the option is present, all of the votes are taken into account. The option can be either latest or oldest to indicate which one to keep.
- revote (ì¬í¬í) can be specified if keep is specified. Indicates the time period required between votes. For example, users could be allowed to vote more than once per day, but only their latest vote each day would be considered, if revote is set to mul(24 3600). If the user voted yesterday as well as today, both votes will be counted.
article-info
ê³ì°ì í¬í¨ë ì ìëë¡ ê¸°ì¬ìì ì 보를 ì¶ì¶. 첫 ë²ì§¸ ì¸ìë ì¸ì ë íì 'article' (기ì¬)ê° ëì´ì¼í¨ . ê·¸ ì¸ ë¤ë¥¸ ê°ì´ ëë ê²½ì°, ì°ì°ì íê°ë ê°ì²´ì ëíì¬ ê±´ëë°ì´ì§ê² ëì´, ì´ë¥¼ ê³µì ì í-í¹íìì¼ ë²ë¦½ëë¤.
ì¬ì©ê°ë¥í ìì±ë¤:
- rating (ë±ê¸), 기ì¬ì 첨ë¶ë ì ì ë±ê¸
- view-count
- age-second
- age-hour
- age-day
- age-week
- age-month
ìì Copy to clipboard (article-info type object-id rating)
(article-info (str article) 42 age-month)
ìì±
ë³´íµì ê°ì²´ ìì±ìì ì 보를 ì¶ì¶í¨.
ìì Copy to clipboard (attribute
(object type object-id)
(property tiki.proposal.accept)
)
-> [value for page in a rating calculation]
(attribute
(object (str wiki page) 14)
(property tiki.proposal.accept)
(default 0)
)
-> [value for page id 14]
tracker-field
í¸ë커 í목ìì ì 보를 ì¶ì¶í¨. íë ê°ì ì«ìë¡ ìëì¼ë¡ ë³íë¨. ê°ì´ ë°ê²¬ëì§ ìê±°ë ì ì© ë¶ê°ë¥ í ê²½ì° 0 ì´ ì ê³µë¨.
ìì Copy to clipboard (tracker-field
(object type object-id)
(field priority)
)
-> [value contained in the tracker item field with permanent name ''priority'']
category-present
ê°ì²´ìì ì¡´ì¬íë 모ë ëì´ë ë²ì£¼ì ì ìì 1 ì ë¶ì¬í¨.
ìì Copy to clipboard (category-present
(object type object-id)
(list 3 4)
)
-> [0, 1 or 2 - Depending on how many of categories 3 or 4 are on the object]
ë¶ë¡
íµí© ê²ì (unified search) ì´ ì¬ì©ë ë, ì¬ê³ì°ì ì¬ìì¸ ëì ì´ë£¨ì´ì§ëë¡ êµ¬ì±ë ì ììµëë¤, ê³ ë¡ ì´ ì¤í¬ë¦½í¸ê° íì ìì´ì§ëë¤.
Cron job Copy to clipboard <?php
chdir('/path/to/tikiroot');
require_once 'tiki-setup.php';
require_once 'lib/rating/ratinglib.php';
$ratinglib->refresh_all();
ê´ë ¨
ë³ì¹
ê³ ê¸+ë±ê¸ | ê³ ê¸ë±ê¸
|