Feasibility question for solution design

Context: one of the projects I'm working on requires "google" like search functionality. We're talking wildcard searches, partial searches, support for search operators (+, -, "And", "not", "or") among other things. If we were to build this in Mendix, the search will have to pan across multiple domain entities (tables) and complex joins. Challenge: I noticed that the in-built Mendix search functionality only allows you to search within an entity object (on the attributes of that entity) Given this fact, is it feasible to build such search functionality using Mendix? If yes, I'd really appreciate ideas on how one might achieve this. An additional consideration is that this system might need to serve several hundred thousand users at any given point of time.
2 answers

You could go for the Lucene Text Search module:


Other option is to build this functionality in Java. I did something similar once with all kinds of SAP like operators like you mention above. The challenge there was for me to, based on the custom input parameters that you create, build up the most efficient XPath constraint to fire to the database.

For this I added a custom non-persistent entity and in this entity created for each attribute to search on two attributes, the parameter as an enumeration of (contains, starts with, >,<,etc.) and the actual attribute name. Each attribute has a logical XPath constraint for it, which you could get from the Mendix ModelReflection. Bundle all constraints in the Java code, optimize it (shortest path) and fire the XPath to the database.


Hi Sid,

  I believe Ivo's suggestion of the Lucene Text Search is the best idea.  I have built something similar in Mendix using only Miroflows with retrieve activities, but this solution can rapidly grow in size and complexity as more entities are introduced.  When I did this, we had a non-persistent search entity that contained some operators like 'and/or/not' and then a drop down list of field names.  A user could build a query using the list of attributes and the and/or/not modifiers.  Then you can loop through this list of query statements and run some big microflow to do XPath retrieves on the attributes specified in your query builder objects. 

  Based on my experience this was a big headache.  Mendix does not allow you to pass a variable to an XPath retrieve to specify the field name, so I strongly encourage you to look at a more programatic way of doing this.