HOWTO: Using like operator in a filter text of a view

Sep 17, 2013 at 4:53 PM
Using method Query, as it is possible to simulate the expression like (sql) for a specific field?

Result<object> Query(string viewname, string filter);
where filter:
Start with -> Name like "% my partial text"
or end with -> Name like "my partial text%"
or contains -> Name like "% my partial text%"

there is a workaround?

Thanks in advance
Sep 17, 2013 at 5:41 PM
If your column is a fulltext indexed string then you can do the above with the default being contains matching "my partial text" == any row with "my" or "partial" or "text"

The rules follow the lucene convention so "+my +partial +text" == row with "my" and "partial" and "text".

You can use wildcards also "*" == any string , "?" == any character.
Sep 18, 2013 at 9:22 PM
Thanks for the quick response.

I also thought of using the fulltext index, but the problem lies in the fact that one does not allow me to discriminate the type of the class because I can not even declare on which view I want to use

Do you think you can assume in a future version the possibility of declaring a query on a view and be able to include a filter lucene? Or something like that?

Sep 19, 2013 at 8:05 AM
1) You can have fulltext indexes on string columns in views.
2) You can change your views anytime you want and RaptorDB will rebuild it (when you increment the view.Version property), so you can start with something and change it when ever you have more information on how you intend to query.
3) If all else fails there is a fulltext index on the complete document saved with FullTextSearch()