Merge remote-tracking branch 'origin/v8/dev' into netcore/dev

# Conflicts:
#	src/SolutionInfo.cs
#	src/Umbraco.Abstractions/Constants-Conventions.cs
This commit is contained in:
Shannon
2019-11-18 19:58:42 +11:00
31 changed files with 2566 additions and 2408 deletions
@@ -225,8 +225,17 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (builtinProperties.ContainsKey(propertyType.Alias))
{
//this reset's its current data type reference which will be re-assigned based on the property editor assigned on the next line
propertyType.DataTypeId = 0;
propertyType.DataTypeKey = default;
var propDefinition = builtinProperties[propertyType.Alias];
if (propDefinition != null)
{
propertyType.DataTypeId = propDefinition.DataTypeId;
propertyType.DataTypeKey = propDefinition.DataTypeKey;
}
else
{
propertyType.DataTypeId = 0;
propertyType.DataTypeKey = default;
}
}
}
}
+46 -3
View File
@@ -1,9 +1,13 @@
using Examine;
using System;
using Examine;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.ValueConverters;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
@@ -13,14 +17,16 @@ namespace Umbraco.Examine
{
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
private readonly IUserService _userService;
private readonly ILogger _logger;
public MediaValueSetBuilder(PropertyEditorCollection propertyEditors,
UrlSegmentProviderCollection urlSegmentProviders,
IUserService userService)
IUserService userService, ILogger logger)
: base(propertyEditors, false)
{
_urlSegmentProviders = urlSegmentProviders;
_userService = userService;
_logger = logger;
}
/// <inheritdoc />
@@ -29,6 +35,42 @@ namespace Umbraco.Examine
foreach (var m in media)
{
var urlValue = m.GetUrlSegment(_urlSegmentProviders);
var umbracoFilePath = string.Empty;
var umbracoFile = string.Empty;
var umbracoFileSource = m.GetValue<string>(Constants.Conventions.Media.File);
if (umbracoFileSource.DetectIsJson())
{
ImageCropperValue cropper = null;
try
{
cropper = JsonConvert.DeserializeObject<ImageCropperValue>(
m.GetValue<string>(Constants.Conventions.Media.File));
}
catch (Exception ex)
{
_logger.Error<MediaValueSetBuilder>(ex, $"Could not Deserialize ImageCropperValue for item with key {m.Key} ");
}
if (cropper != null)
{
umbracoFilePath = cropper.Src;
}
}
else
{
umbracoFilePath = umbracoFileSource;
}
if (!string.IsNullOrEmpty(umbracoFilePath))
{
// intentional dummy Uri
var uri = new Uri("https://localhost/" + umbracoFilePath);
umbracoFile = uri.Segments.Last();
}
var values = new Dictionary<string, IEnumerable<object>>
{
{"icon", m.ContentType.Icon?.Yield() ?? Enumerable.Empty<string>()},
@@ -44,7 +86,8 @@ namespace Umbraco.Examine
{"urlName", urlValue?.Yield() ?? Enumerable.Empty<string>()},
{"path", m.Path?.Yield() ?? Enumerable.Empty<string>()},
{"nodeType", m.ContentType.Id.ToString().Yield() },
{"creatorName", (m.GetCreatorProfile(_userService)?.Name ?? "??").Yield()}
{"creatorName", (m.GetCreatorProfile(_userService)?.Name ?? "??").Yield()},
{UmbracoExamineIndex.UmbracoFileFieldName, umbracoFile.Yield()}
};
foreach (var property in m.Properties)
+1 -1
View File
@@ -49,7 +49,7 @@
</ItemGroup>
<ItemGroup>
<!-- note: NuGet deals with transitive references now -->
<PackageReference Include="Examine" Version="1.0.0" />
<PackageReference Include="Examine" Version="1.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>1.0.0-beta2-19324-01</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -32,6 +32,7 @@ namespace Umbraco.Examine
/// </summary>
public const string IndexPathFieldName = SpecialFieldPrefix + "Path";
public const string NodeKeyFieldName = SpecialFieldPrefix + "Key";
public const string UmbracoFileFieldName = "umbracoFileSrc";
public const string IconFieldName = SpecialFieldPrefix + "Icon";
public const string PublishedFieldName = SpecialFieldPrefix + "Published";
+1 -1
View File
@@ -78,7 +78,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.3.1" />
<PackageReference Include="Examine" Version="1.0.0" />
<PackageReference Include="Examine" Version="1.0.1" />
<PackageReference Include="HtmlAgilityPack">
<Version>1.8.14</Version>
</PackageReference>
@@ -7,6 +7,7 @@ using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Store;
using Moq;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
@@ -44,11 +45,10 @@ namespace Umbraco.Tests.UmbracoExamine
public static MediaIndexPopulator GetMediaIndexRebuilder(PropertyEditorCollection propertyEditors, IMediaService mediaService)
{
var mediaValueSetBuilder = new MediaValueSetBuilder(propertyEditors, new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }), GetMockUserService());
var mediaValueSetBuilder = new MediaValueSetBuilder(propertyEditors, new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }), GetMockUserService(), GetMockLogger());
var mediaIndexDataSource = new MediaIndexPopulator(null, mediaService, mediaValueSetBuilder);
return mediaIndexDataSource;
}
public static IContentService GetMockContentService()
{
long longTotalRecs;
@@ -146,6 +146,11 @@ namespace Umbraco.Tests.UmbracoExamine
return mediaTypeServiceMock.Object;
}
public static IProfilingLogger GetMockLogger()
{
return new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>());
}
public static UmbracoContentIndex GetUmbracoIndexer(
IProfilingLogger profilingLogger,
Directory luceneDir,
@@ -259,19 +259,18 @@ function dependencies() {
//css, fonts and image files
var assetsTask = gulp.src(config.sources.globs.assets, { allowEmpty: true });
if (global.isProd === true) {
assetsTask = assetsTask.pipe(imagemin([
imagemin.gifsicle({interlaced: true}),
imagemin.jpegtran({progressive: true}),
imagemin.optipng({optimizationLevel: 5}),
imagemin.svgo({
plugins: [
{removeViewBox: true},
{cleanupIDs: false}
]
})
]));
}
assetsTask = assetsTask.pipe(imagemin([
imagemin.gifsicle({interlaced: true}),
imagemin.jpegtran({progressive: true}),
imagemin.optipng({optimizationLevel: 5}),
imagemin.svgo({
plugins: [
{removeViewBox: true},
{cleanupIDs: false}
]
})
]));
assetsTask = assetsTask.pipe(gulp.dest(config.root + config.targets.assets));
stream.add(assetsTask);
@@ -1,22 +0,0 @@
'use strict';
var gulp = require('gulp');
var through2 = require('through2');
function createEmptyStream() {
var pass = through2.obj();
process.nextTick(pass.end.bind(pass));
return pass;
}
/**************************
* Copies all angular JS files into their separate umbraco.*.js file
**************************/
function removeProductionMode() {
global.isProd = false;
return createEmptyStream();
};
module.exports = { removeProductionMode: removeProductionMode };
@@ -23,11 +23,10 @@ module.exports = function (files, out) {
// sort files in stream by path or any custom sort comparator
task = task.pipe(babel())
.pipe(sort());
if (global.isProd === true) {
//in production, embed the templates
task = task.pipe(embedTemplates({ basePath: "./src/", minimize: { loose: true } }))
}
//in production, embed the templates
task = task.pipe(embedTemplates({ basePath: "./src/", minimize: { loose: true } }))
task = task.pipe(concat(out))
.pipe(wrap('(function(){\n%= body %\n})();'))
.pipe(gulp.dest(config.root + config.targets.js));
-4
View File
@@ -10,8 +10,6 @@
* and then add the exports command to add the new item into the task menu.
*/
global.isProd = true;
const { src, dest, series, parallel, lastRun } = require('gulp');
const { dependencies } = require('./gulp/tasks/dependencies');
@@ -20,7 +18,6 @@ const { less } = require('./gulp/tasks/less');
const { testE2e, testUnit } = require('./gulp/tasks/test');
const { views } = require('./gulp/tasks/views');
const { watchTask } = require('./gulp/tasks/watchTask');
const { removeProductionMode } = require('./gulp/tasks/removeProductionMode');
// Load local overwrites, can be used to overwrite paths in your local setup.
var fs = require('fs');
@@ -41,7 +38,6 @@ try {
// ***********************************************************
exports.build = series(parallel(dependencies, js, less, views), testUnit);
exports.dev = series(parallel(dependencies, js, less, views), watchTask);
exports.fastdev = series(removeProductionMode, parallel(dependencies, js, less, views), watchTask);
exports.watch = series(watchTask);
//
exports.runTests = series(js, testUnit);
@@ -195,6 +195,7 @@ Use this directive to construct a header inside the main editor window.
@param {string=} icon Show and edit the content icon. Opens an overlay to change the icon.
@param {boolean=} hideIcon Set to <code>true</code> to hide icon.
@param {string=} alias show and edit the content alias.
@param {boolean=} aliasLocked Set to <code>true</code> to lock the alias.
@param {boolean=} hideAlias Set to <code>true</code> to hide alias.
@param {string=} description Add a description to the content.
@param {boolean=} hideDescription Set to <code>true</code> to hide description.
@@ -347,6 +348,7 @@ Use this directive to construct a header inside the main editor window.
icon: "=",
hideIcon: "@",
alias: "=",
aliasLocked: "<",
hideAlias: "=",
description: "=",
hideDescription: "@",
@@ -56,6 +56,7 @@ function confirmDirective() {
onCancel: '=',
caption: '@',
confirmButtonStyle: '@',
confirmDisabled: '<?',
confirmLabelKey: '@'
},
link: function (scope, element, attr, ctrl) {
@@ -161,6 +161,7 @@ input.umb-table__input {
line-height: 20px;
color: @ui-option-type;
vertical-align: bottom;
text-decoration: none;
}
.umb-table-body__checkicon,
@@ -63,6 +63,10 @@ a.umb-user-details-details__back-link {
.umb-user-details-details__sidebar {
flex: 0 0 @sidebarwidth;
.umb-button{
margin-left:0px;
}
}
@media (max-width: 768px) {
@@ -101,6 +105,7 @@ a.umb-user-details-details__back-link {
.umb-user-details-details__information-item {
margin-bottom: 10px;
font-size: 13px;
margin-top:10px;
}
.umb-user-details-details__information-item-label {
@@ -169,9 +169,9 @@
ng-change="updateTemplate(node.template)">
<option value="">{{chooseLabel}}...</option>
</select>
<a href="" ng-show="allowChangeTemplate && node.template !== null" class="umb-node-preview__action" style="margin-left:15px;" ng-click="openTemplate()">
<button ng-show="allowChangeTemplate && node.template !== null" class="umb-node-preview__action" style="margin-left:15px;" ng-click="openTemplate()">
<localize key="general_open">Open</localize>
</a>
</button>
</div>
</umb-control-group>
@@ -14,6 +14,7 @@
action="confirm()"
button-style="{{confirmButtonStyle || 'primary'}}"
state="confirmButtonState"
disabled="confirmDisabled === true"
label-key="{{confirmLabelKey || 'general_ok'}}">
</umb-button>
</div>
@@ -1,14 +1,30 @@
<umb-box>
<umb-box-content>
<h3 class="bold">Start here</h3>
<p>This section contains the building blocks for your Umbraco site. Follow the below links to find out more about working with the items in the Settings section:</p>
<h5>Find out more:</h5>
<h3 class="bold">
<localize key="settingsDashboard_start">Start here</localize>
</h3>
<localize key="settingsDashboard_startDescription">
<p>This section contains the building blocks for your Umbraco site. Follow the below links to find out more about working with the items in the Settings section:</p>
</localize>:
<h5>
<localize key="settingsDashboard_more">Find out more</localize>:
</h5>
<ul>
<li>Read more about working with the items in Settings <a class="btn-link -underline" href="https://our.umbraco.com/documentation/Getting-Started/Backoffice/Sections/" target="_blank">in the Documentation section</a> of Our Umbraco</li>
<li>Ask a question in the <a class="btn-link -underline" href="https://our.umbraco.com/forum" target="_blank">Community Forum</a></li>
<li>Watch our <a class="btn-link -underline" href="https://umbraco.tv" target="_blank">tutorial videos</a> (some are free, some require a subscription)</li>
<li>Find out about our <a class="btn-link -underline" href="https://umbraco.com/products/" target="_blank">productivity boosting tools and commercial support</a></li>
<li>Find out about real-life <a class="btn-link -underline" href="https://umbraco.com/training/" target="_blank">training and certification</a> opportunities</li>
<li>
<localize key="settingsDashboard_bulletPointOne">Read more about working with the items in Settings <a class="btn-link -underline" href="https://our.umbraco.com/documentation/Getting-Started/Backoffice/Sections/" target="_blank">in the Documentation section</a> of Our Umbraco</localize>
</li>
<li>
<localize key="settingsDashboard_bulletPointTwo">Ask a question in the <a class="btn-link -underline" href="https://our.umbraco.com/forum" target="_blank">Community Forum</a></localize>
</li>
<li>
<localize key="settingsDashboard_bulletPointThree">Watch our <a class="btn-link -underline" href="https://umbraco.tv" target="_blank">tutorial videos</a> (some are free, some require a subscription)</localize>
</li>
<li>
<localize key="settingsDashboard_bulletPointFour">Find out about our <a class="btn-link -underline" href="https://umbraco.com/products/" target="_blank">productivity boosting tools and commercial support</a></localize>
</li>
<li>
<localize key="settingsDashboard_bulletPointFive">Find out about real-life <a class="btn-link -underline" href="https://umbraco.com/training/" target="_blank">training and certification</a> opportunities</localize>
</li>
</ul>
</umb-box-content>
</umb-box>
@@ -51,6 +51,12 @@ function DataTypeDeleteController($scope, dataTypeResource, treeService, navigat
navigationService.hideDialog();
};
vm.onReferenceClicked = function(event) {
if (event.metaKey !== true) {
navigationService.hideDialog();
}
};
vm.labels = {};
localizationService
.localize("editdatatype_acceptDeleteConsequence", [$scope.currentNode.name])
@@ -50,7 +50,7 @@
</thead>
<tbody>
<tr ng-repeat="relation in vm.references.documentTypes">
<td><span title="{{::relation.name}}({{::relation.alias}})"><i class="umb-table-body__icon {{relation.icon}}"></i>{{::relation.name}}</span></td>
<td><a title="{{::relation.name}}({{::relation.alias}})" href="#/settings/documentTypes/edit/{{::relation.id}}" ng-click="vm.onReferenceClicked($event)"><i class="umb-table-body__icon {{relation.icon}}"></i>{{::relation.name}}</a></td>
<td><div><p class="red" ng-repeat="property in relation.properties"><i class="icon icon-alert red"></i>{{::property.name}}</p></div></td>
</tr>
</tbody>
@@ -74,7 +74,7 @@
</thead>
<tbody>
<tr ng-repeat="relation in vm.references.mediaTypes">
<td><span title="{{::relation.name}}({{::relation.alias}})"><i class="umb-table-body__icon {{relation.icon}}"></i>{{::relation.name}}</span></td>
<td><a title="{{::relation.name}}({{::relation.alias}})" href="#/settings/documentTypes/edit/{{::relation.id}}" ng-click="vm.onReferenceClicked($event)"><i class="umb-table-body__icon {{relation.icon}}"></i>{{::relation.name}}</a></td>
<td><div><p class="red" ng-repeat="property in relation.properties"><i class="icon icon-alert red"></i>{{::property.name}}</p></div></td>
</tr>
</tbody>
@@ -98,7 +98,7 @@
</thead>
<tbody>
<tr ng-repeat="relation in vm.references.memberTypes">
<td><span title="{{::relation.name}}({{::relation.alias}})"><i class="umb-table-body__icon {{relation.icon}}"></i>{{::relation.name}}</span></td>
<td><a title="{{::relation.name}}({{::relation.alias}})" href="#/settings/documentTypes/edit/{{::relation.id}}" ng-click="vm.onReferenceClicked($event)"><i class="umb-table-body__icon {{relation.icon}}"></i>{{::relation.name}}</a></td>
<td><div><p class="red" ng-repeat="property in relation.properties"><i class="icon icon-alert red"></i>{{::property.name}}</p></div></td>
</tr>
</tbody>
@@ -68,7 +68,7 @@
<div class="umb-table-cell umb-table__name"><span>{{::reference.name}}</span></div>
<div class="umb-table-cell"><span title="{{::reference.alias}}">{{::reference.alias}}</span></div>
<div class="umb-table-cell --noOverflow"><span>{{::reference.properties | umbCmsJoinArray:', ':'name'}}</span></div>
<div class="umb-table-cell umb-table-cell--nano"><a href="#/settings/documentTypes/edit/{{::reference.id}}"><localize key="general_open">Open</localize></a></div>
<div class="umb-table-cell umb-table-cell--nano"><a href="#/settings/mediaTypes/edit/{{::reference.id}}"><localize key="general_open">Open</localize></a></div>
</div>
</div>
</div>
@@ -98,7 +98,7 @@
<div class="umb-table-cell umb-table__name"><span>{{::reference.name}}</span></div>
<div class="umb-table-cell"><span title="{{::reference.alias}}">{{::reference.alias}}</span></div>
<div class="umb-table-cell --noOverflow"><span>{{::reference.properties | umbCmsJoinArray:', ':'name'}}</span></div>
<div class="umb-table-cell umb-table-cell--nano"><a href="#/settings/documentTypes/edit/{{::reference.id}}"><localize key="general_open">Open</localize></a></div>
<div class="umb-table-cell umb-table-cell--nano"><a href="#/settings/memberTypes/edit/{{::reference.id}}"><localize key="general_open">Open</localize></a></div>
</div>
</div>
</div>
@@ -673,6 +673,7 @@ angular.module("umbraco")
return ((spans / $scope.model.config.items.columns) * 100).toFixed(8);
};
$scope.clearPrompt = function (scopedObject, e) {
scopedObject.deletePrompt = false;
e.preventDefault();
@@ -692,8 +693,15 @@ angular.module("umbraco")
};
$scope.getTemplateName = function (control) {
if (control.editor.nameExp) return control.editor.nameExp(control)
return control.editor.name;
var templateName = control.editor.name;
if (control.editor.nameExp) {
var valueOfTemplate = control.editor.nameExp(control);
if (valueOfTemplate != "") {
templateName += ": ";
templateName += valueOfTemplate;
}
}
return templateName;
}
// *********************************************
@@ -95,7 +95,7 @@
</div>
<div class="cell-tools-remove row-tool">
<i class="icon-trash" ng-click="togglePrompt(row)"></i>
<i class="icon-trash" ng-click="togglePrompt(row)" localize="title" title="@delete"></i>
<umb-confirm-action
ng-if="row.deletePrompt"
direction="left"
@@ -200,7 +200,7 @@
</div>
<div class="umb-control-tool">
<i class="umb-control-tool-icon icon-trash" ng-click="togglePrompt(control)"></i>
<i class="umb-control-tool-icon icon-trash" ng-click="togglePrompt(control)" localize="title" title="@delete"></i>
<umb-confirm-action ng-if="control.deletePrompt"
direction="left"
on-confirm="removeControl(area, $index)"
@@ -322,7 +322,7 @@
rows="4">
</textarea>
<umb-button type="button"
button-style="[info,block]"
button-style="[action,block]"
action="model.resendInvite()"
state="model.resendInviteButtonState"
label="Resend Invite"
+6 -3
View File
@@ -84,9 +84,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CSharpTest.Net.Collections" Version="14.906.1403.1082" />
<PackageReference Include="ClientDependency" Version="1.9.7" />
<PackageReference Include="ClientDependency-Mvc5" Version="1.8.0.0" />
<PackageReference Include="Examine" Version="1.0.0" />
<PackageReference Include="ClientDependency" Version="1.9.8" />
<PackageReference Include="ClientDependency-Mvc5" Version="1.9.3" />
<PackageReference Include="Examine" Version="1.0.1" />
<PackageReference Include="ImageProcessor.Web" Version="4.10.0.100" />
<PackageReference Include="ImageProcessor.Web.Config" Version="2.5.0.100" />
<PackageReference Include="Microsoft.AspNet.Identity.Owin" Version="2.2.2" />
@@ -351,6 +351,9 @@
<DevelopmentServerPort>9000</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:9000/</IISUrl>
<DevelopmentServerPort>8600</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:8600/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
@@ -85,7 +85,7 @@ else
easily change it. For example, if you wanted to render a custom editor for this field called "MyEditor" you would
create a file at ~/Views/Shared/EditorTemplates/MyEditor.cshtml", then you will change the next line of code to
render your specific editor template like:
@Html.EditorFor(m => profileModel.MemberProperties[i].Value, "MyEditor")
@Html.EditorFor(m => registerModel.MemberProperties[i].Value, "MyEditor")
*@
@Html.EditorFor(m => registerModel.MemberProperties[i].Value)
@Html.HiddenFor(m => registerModel.MemberProperties[i].Alias)
@@ -2303,4 +2303,34 @@ To manage your website, simply open the Umbraco back office and start adding con
</key>
<key alias="getStarted">To get you started</key>
</area>
<area alias="settingsDashboard">
<key alias="start">Start here</key>
<key alias="startDescription">This section contains the building blocks for your Umbraco site. Follow the below links to find out more about working with the items in the Settings section</key>
<key alias="more">Find out more</key>
<key alias="bulletPointOne">
<![CDATA[
Read more about working with the items in Settings <a class="btn-link -underline" href="https://our.umbraco.com/documentation/Getting-Started/Backoffice/Sections/" target="_blank">in the Documentation section</a> of Our Umbraco
]]>
</key>
<key alias="bulletPointTwo">
<![CDATA[
Ask a question in the <a class="btn-link -underline" href="https://our.umbraco.com/forum" target="_blank">Community Forum</a>
]]>
</key>
<key alias="bulletPointThree">
<![CDATA[
Watch our <a class="btn-link -underline" href="https://umbraco.tv" target="_blank">tutorial videos</a> (some are free, some require a subscription)
]]>
</key>
<key alias="bulletPointFour">
<![CDATA[
Find out about our <a class="btn-link -underline" href="https://umbraco.com/products/" target="_blank">productivity boosting tools and commercial support</a>
]]>
</key>
<key alias="bulletPointFive">
<![CDATA[
Find out about real-life <a class="btn-link -underline" href="https://umbraco.com/training/" target="_blank">training and certification</a> opportunities
]]>
</key>
</area>
</language>
File diff suppressed because it is too large Load Diff
@@ -7,14 +7,14 @@
},
{
"name": "Image",
"nameTemplate": "{{ 'Image: ' + (value.udi | ncNodeName) }}",
"nameTemplate": "{{ value && value.udi ? (value.udi | ncNodeName) : '' }}",
"alias": "media",
"view": "media",
"icon": "icon-picture"
},
{
"name": "Macro",
"nameTemplate": "{{ 'Macro: ' + value.macroAlias }}",
"nameTemplate": "{{ value && value.macroAlias ? value.macroAlias : '' }}",
"alias": "macro",
"view": "macro",
"icon": "icon-settings-alt"
@@ -27,7 +27,7 @@
},
{
"name": "Headline",
"nameTemplate": "{{ 'Headline: ' + value }}",
"nameTemplate": "{{ value }}",
"alias": "headline",
"view": "textstring",
"icon": "icon-coin",
@@ -38,6 +38,7 @@
},
{
"name": "Quote",
"nameTemplate": "{{ value ? value.substring(0,32) + (value.length > 32 ? '...' : '') : '' }}",
"alias": "quote",
"view": "textstring",
"icon": "icon-quote",
@@ -177,6 +177,14 @@ namespace Umbraco.Web.Models.Mapping
target.Name = source.Values.ContainsKey("nodeName") ? source.Values["nodeName"] : "[no name]";
if (source.Values.TryGetValue(UmbracoExamineIndex.UmbracoFileFieldName, out var umbracoFile))
{
if (umbracoFile != null)
{
target.Name = $"{target.Name} ({umbracoFile})";
}
}
if (source.Values.ContainsKey(UmbracoExamineIndex.NodeKeyFieldName))
{
if (Guid.TryParse(source.Values[UmbracoExamineIndex.NodeKeyFieldName], out var key))
+20 -4
View File
@@ -67,7 +67,7 @@ namespace Umbraco.Web.Search
string type;
var indexName = Constants.UmbracoIndexes.InternalIndexName;
var fields = new[] { "id", "__NodeId", "__Key" };
var fields = new List<string> { "id", "__NodeId", "__Key" };
// TODO: WE should try to allow passing in a lucene raw query, however we will still need to do some manual string
// manipulation for things like start paths, member types, etc...
@@ -87,7 +87,7 @@ namespace Umbraco.Web.Search
case UmbracoEntityTypes.Member:
indexName = Constants.UmbracoIndexes.MembersIndexName;
type = "member";
fields = new[] { "id", "__NodeId", "__Key", "email", "loginName" };
fields.AddRange(new[]{ "email", "loginName"});
if (searchFrom != null && searchFrom != Constants.Conventions.MemberTypes.AllMembersListId && searchFrom.Trim() != "-1")
{
sb.Append("+__NodeTypeAlias:");
@@ -97,6 +97,7 @@ namespace Umbraco.Web.Search
break;
case UmbracoEntityTypes.Media:
type = "media";
fields.AddRange(new[] { UmbracoExamineIndex.UmbracoFileFieldName });
var allMediaStartNodes = _umbracoContext.Security.CurrentUser.CalculateMediaStartNodeIds(_entityService);
AppendPath(sb, UmbracoObjectTypes.Media, allMediaStartNodes, searchFrom, ignoreUserStartNodes, _entityService);
break;
@@ -161,7 +162,7 @@ namespace Umbraco.Web.Search
return _mapper.MapEnumerable<IEntitySlim, SearchResultEntity>(results);
}
private bool BuildQuery(StringBuilder sb, string query, string searchFrom, string[] fields, string type)
private bool BuildQuery(StringBuilder sb, string query, string searchFrom, List<string> fields, string type)
{
//build a lucene query:
// the nodeName will be boosted 10x without wildcards
@@ -234,11 +235,26 @@ namespace Umbraco.Web.Search
foreach (var f in fields)
{
var queryWordsReplaced = new string[querywords.Length];
// when searching file names containing hyphens we need to replace the hyphens with spaces
if (f.Equals(UmbracoExamineIndex.UmbracoFileFieldName))
{
for (var index = 0; index < querywords.Length; index++)
{
queryWordsReplaced[index] = querywords[index].Replace("\\-", " ").Replace("_", " ").Trim(" ");
}
}
else
{
queryWordsReplaced = querywords;
}
//additional fields normally
sb.Append(f);
sb.Append(":");
sb.Append("(");
foreach (var w in querywords)
foreach (var w in queryWordsReplaced)
{
sb.Append(w.ToLower());
sb.Append("* ");
+2 -2
View File
@@ -60,9 +60,9 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ClientDependency" Version="1.9.7" />
<PackageReference Include="ClientDependency" Version="1.9.8" />
<PackageReference Include="CSharpTest.Net.Collections" Version="14.906.1403.1082" />
<PackageReference Include="Examine" Version="1.0.0" />
<PackageReference Include="Examine" Version="1.0.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.8.14" />
<PackageReference Include="ImageProcessor">
<Version>2.7.0.100</Version>