Menu

Commit [r5530]  Maximize  Restore  History

TracSearch: refactor the Search API in a similar way than the recent Timeline API refactoring (see r5523).

Quite similar to the `TimelineEvent` object used to collect timeline entries, there's now a `SearchResult` object for collecting the matches provided by the search sources, instead of the tuple used before.

The advantage of such an approach over the use of a tuple is an increased clarity and greater extensibility of the API.

In addition to the fields and methods which are similar to the ones of the `TimelineEvent` object, there's also a '''weight''' property which will be used to sort the matches by order of relevance.

Each occurrence of the terms in the matched resource would normally count for 1. A search source can increase the weight of some hits if the search terms appear in some more sensitive place (in the title of the resource, in a ''keywords'' field, etc.). As this weight is not an exact measure of the hit count, it can also be referred to as the ''bogohits'' count.

The legacy ISearchSource providers are still supported.

cboos 2007-05-28

changed /sandbox/search-api-tmp/trac/search/api.py
changed /sandbox/search-api-tmp/trac/search/templates/search.html
changed /sandbox/search-api-tmp/trac/search/web_ui.py
/sandbox/search-api-tmp/trac/search/api.py Diff Switch to side-by-side view
Loading...
/sandbox/search-api-tmp/trac/search/templates/search.html Diff Switch to side-by-side view
Loading...
/sandbox/search-api-tmp/trac/search/web_ui.py Diff Switch to side-by-side view
Loading...
Auth0 Logo