Keyword Ranking System
xendune uses a weighted ranking formula to determine product search order for each keyword. The system combines organic metrics with paid bid-based ranking.
Components
KeywordWeight Contract
Calculates organic ranking scores using four factors, each with caps to prevent gaming:
| Factor | Description | Weight | Cap |
|---|---|---|---|
| Sales | Total completed orders | Configurable | Capped |
| Rating Score | Positive reviews / total reviews | Configurable | Capped |
| Activity | Time since last activity | Configurable | Capped |
| Arbitration History | Dispute history (negative factor) | Configurable | Capped |
The formula uses integer arithmetic (x1000 multiplier) to avoid floating-point precision issues on-chain.
KeywordAuction Contract
Manages paid ranking positions:
- Up to 20 bid slots per keyword
- Higher bids rank higher
- Bid winners displayed above organic ranking results
Ranking Calculation
For each product under a keyword:
- Calculate organic ranking score via KeywordWeight (4 factors)
- Check if product holds a bid slot in KeywordAuction
- Products with bid slots displayed first
- Organic ranking results sorted internally by weighted score
Metric Recording
Metrics are recorded automatically during normal platform operations:
- Sales: Recorded on settlement via
ProductLib.settle() - Ratings: Recorded when buyer/seller submits review via
submitReview() - Activity: Updated on product creation, order creation, shipping
- Arbitration: Recorded on dispute resolution via
PlatformSettings.recordArbitration()
Anti-Gaming Mechanisms
- Each ranking factor has a configurable cap—even with thousands of sales, sales score cannot exceed its cap value
- Arbitration history acts as a negative factor, penalizing merchants with frequent disputes
- Only product contracts authorized by factory can record metrics
- Review manipulation limited by "one review per party per order" rule