Custom Search Rules

Osclass 8.3 has introduced a major feature called "Custom Search Rules" in the Settings > Permalinks section. This feature enables you to create up to 26 custom search rules based on active search parameters. These rules allow you to create flexible and optimized URLs for your search pages, improving user experience and making the search more intuitive.

Customize Search Page URL Structure

Custom Search Rules allow you to define URL structures based on search parameters like city, category, price, etc. These rules can be either strict or fuzzy, meaning you can choose to accept only exact parameters or allow extra parameters for greater flexibility.

Custom search rules
Custom search rules

The custom search rules are fully compatible with plugin/theme custom parameters and meta fields, ensuring they are customizable for various use cases. You can create more specific search URLs, for example, linking certain categories or regions with unique URL patterns.

How Custom Search Rules Work

  • Strict Rules: If strict mode is enabled, only search parameters that exactly match the rule are accepted. Any additional parameters will invalidate the rule.
  • Fuzzy Rules: Fuzzy rules allow for extra parameters, enabling more flexible search results.
  • Priority of Rules: Custom search rules have higher priority than canonical URLs. Custom rules are prioritized from Z (highest) to A (lowest).
  • Example Rules:
    • {sCity}/{sCategory}/a/bremen/for-sale
    • {sRegion}/{sCity}/{sCategory}/b/alabama/bremen/for-sale
    • cat:{sCategory}/city:{sCity}/min-{sPriceMin}-eur/c/category:for-sale/city:bremen/min-55-eur

Creating Custom Search Rules
To create a custom search rule, go to Settings > Permalinks, where you’ll find the option to enable custom search rules. Here are some examples of different rule formats you can use:

  • {sCity}/{sCategory}
  • {sRegion}/{sCity}
  • cat:/{sCity}-from/min-{sPriceMin}-eur

These rules allow you to structure your URLs based on relevant search parameters such as location, price, and category.

Technical Considerations
When using custom rules, remember that:

  • Some parameters like lang, iPage, sShowAs, sOrder, and iOrderType are ignored in the rule and added at the end of the rule.
  • Custom rules are activated and applied only when all required parameters are available and not empty.
  • Place more general rules at the top and specific rules at the bottom to avoid conflicts.

How to Use Custom Search Rules Effectively
Custom rules should be used carefully as improper setup can cause unexpected behavior. Below are some tips for using custom search rules:

  • General to Specific: Start with more general rules (e.g., {sCity}/{sCategory}) and gradually add more specific ones (e.g., cat:{sCategory}/city:{sCity}/min-{sPriceMin}-eur).
  • Avoid Overlap: Make sure specific rules don’t overlap with more general rules. Use the Z to A priority system to manage conflicts.
  • Understand the Parameters: Use the correct technical names for parameters like sCategory, sCountry, sRegion, sPriceMin, etc., in your custom rules.

Limitations and Notes

  • Custom search rules require advanced user knowledge to implement correctly.
  • Improper setup may result in unexpected behavior, so it’s recommended to test your rules thoroughly.
  • Custom rules have full support for subdomains, which can help you tailor search results for specific regions or categories.

Conclusion
Custom Search Rules in Osclass allow for advanced URL customizations that enhance the search experience. By setting up rules based on parameters like city, category, and price, you can create search URLs that are more intuitive and relevant for your users. However, it's important to carefully manage these rules to avoid conflicts and ensure smooth functionality.

Where to Access:
You can enable and configure custom search rules in Settings > Permalinks in your Osclass admin panel.