>Now I would like to add one more function by using AbstractSearching: I >would like to search for users by username, first_name, last_name or >email. how could I achive that?
You would have to add lookup or filter functions to your search definition. There are two kind of additional queries that can be added - they create keyword-queries like the domain:my.site.com in Google. The first kind is lookup-keywords - they are defined by adding a method lookup_domain(element, value). This would define a domain: keyword. The method has to return a dictionary that is added to the query kwargs. So this is usually used to add searches for specific fields (while the "global" word search searches in all given fields). The second kind is filter-keywords. These are used to filter the result from the database queries - so they are applied on a per-row basis. This makes them much slower than the lookup keywords, but they can do anything you can code in Python to weed out results that you don't want. To get one, you define a filter_user(element, value) function that could use the value to check wether an element was created by that user. Samples for those are given in the AbstractSearching wiki page - the filter_tagged methods are to filter against my old tagging stuff, they use standard Django ORM functions to check wether there is a tag related to an element. The other samples are the lookup_created and lookup_changed they produce a standard date lookup keyword, the source is in the AbstractSearching package. Often you can translate a string value into some more specific query parameter - for example a user name could be turned into a user id and that could be used to construct a direct lookup kwarg. That's much faster than using the filter keywords on large result sets. What is _not_ possible is to add non-character fields to the global word search. Oh, and all search definitions need to adhere to the same search protocol. So if you have keyword searches that aren't supported by some models, you will have to put dummy keyword functions on them that just return None - this will tell the search machinery to skip those models on those keyword searches. You can have multiple different searchs (searches that run against different search definition lists) by passing in the explicit search definition lists, but usually that's not needed - the idea of the AbstractSearching package is to have a unified search that works much like google or Apples spotlight - one search field where you enter all your queries, regardless of what it is you actually want to search. Some more samples for lookup keywords in searches are given in my CMS project: https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/file/cms/trunk/apps/cms/search.py This search definition searches against 4 different models where the lookup_kind keyword function distinguishes when you want to search only against one model or some models. Since the idea is to have a unified search, the "having different searches with different search definition lists" feature never was tested, so it's absolutely possible that it doesn't work :-) bye, Georg

