fix(aio): relax search on titles further
This change will now match `ControlValueAccessor` for the query `accessor`. Closes #18872
This commit is contained in:
parent
a2b50ec8c9
commit
5cd0d6ab25
|
@ -96,6 +96,8 @@ describe('site App', function() {
|
|||
it('should find pages when searching by a partial word in the title', () => {
|
||||
page.enterSearch('ngCont');
|
||||
expect(page.getSearchResults().map(link => link.getText())).toContain('NgControl');
|
||||
page.enterSearch('accessor');
|
||||
expect(page.getSearchResults().map(link => link.getText())).toContain('ControlValueAccessor');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -51,7 +51,9 @@ export class SitePage {
|
|||
}
|
||||
|
||||
enterSearch(query: string) {
|
||||
element(by.css('.search-container input[type=search]')).sendKeys(query);
|
||||
const input = element(by.css('.search-container input[type=search]'));
|
||||
input.clear();
|
||||
input.sendKeys(query);
|
||||
}
|
||||
|
||||
getSearchResults() {
|
||||
|
|
|
@ -88,7 +88,7 @@ function queryIndex(query) {
|
|||
if (query.length) {
|
||||
// Add a relaxed search in the title for the first word in the query
|
||||
// E.g. if the search is "ngCont guide" then we search for "ngCont guide titleWords:ngCont*"
|
||||
var titleQuery = 'titleWords:' + query.split(' ', 1)[0] + '*';
|
||||
var titleQuery = 'titleWords:*' + query.split(' ', 1)[0] + '*';
|
||||
var results = index.search(query + ' ' + titleQuery);
|
||||
// Map the hits into info about each page to be returned as results
|
||||
return results.map(function(hit) { return pages[hit.ref]; });
|
||||
|
|
Loading…
Reference in New Issue