I need to be able to remove the description text within search results which displays a portion of an indexed document, however I only want this to affect a single library's documents (or sub-site). Is it possible to localize something like this in such a way? Through XSLT, or the sp object model, or custom trimming or anything.. maybe somehow intercept the index query results, strip out the relevant text, then pass it along.
One idea that almost worked was to wrap the srch-description div in the core web part's XSLT in an if statement that checks if the item's url contains my library's name, however this xslt change would have to go into any site that searches on my library and that's not possible. I wonder if there's anything more I can do to remove srch-description or decouple it from my items..
Disclaimer: this is a suggestion - I have not tried this!
I suggest populating (and if necessary creating) a Description field in your document library. This field might contain some innocuous description text. Next, create a new SharePoint search content source pointing to the document library. Map the metadata crawled properties (Description -> ows_Description) and check the "Include values for this property in the search index" checkbox. You may also need to add a crawl rule to the original source to exclude your "special" document library.
Related
In VS2017 I've made a C# Project Template project, that uses forms and the IWizard interface to pop up a dialog as soon as the user types a project name and hits OK. The form gathers info from the user and then sets up the new project accordingly.
I haven't really detoured from the guide mentioned in the next line, except it doesn't cover what I'd like to do.
Note to future readers: This How To Use Wizards With Project Templates guide is the only version of the page I have found that points out the need for the System and System.Drawing references. And even then it says "assemblies" when it means "references". Other duplicates of the same page have a strangely blank space at the crucial moment.
So inside IWizard's RunStarted() function, I create custom template parameters that look $like$ $this$, add them to the replacementsDictionary, and assign values to them that I retrieved from my whiz-bang pop up dialog. The wizard will then substitute appearances of those custom parameters that it finds in files of the new project (I wrote those appearances earlier), with the values I assigned to them. There are also built-in template parameters that I can use in the same way.
What I can do (source files == .cpp, project file == .vcxproj):
Use built-in template parameters to substitute values into my template's source files and project file.
Define custom template parameters inside the .vstemplate file that substitute values into my template's source files and project files.
Define custom template parameters inside IWizard's RunStarted() function that substitute values only into my template's source files.
What I can't do:
Define custom template parameters within IWizard's RunStarted() function that substitute values into my template's project file.
From what I understand, the first moment I can turn user-defined values into custom parameter values is via the RunStarted() function. This is the crux of the problem, as this is apparently too late to sub anything new into the project file. In the end product project file, all built-in template parameters get substituted as expected. All my custom template parameters that I defined in advance in the .vstemplate file are also subbed as expected. But the custom template parameters that I need to set up in RunStarted()... they still all look $like$ $this$.
In other words, if I write this inside RunStarted():
replacementsDictionary.Add("$custommessage$", "Custard");
then my source files will now have occurrences of Custard, but the project file will still only have $custommessage$.
This is forcing an XML-writing work around that is bringing its own problems, so I have come back to this. How can I get user-defined custom template parameter values into the project file?
It's the question that is broken. Template parameters do work in the project file straight off the bat. If they aren't working, it means something is wrong somewhere else. Ie., double check all your template parameters are working, are getting values, etc. It's typically one of them going wrong that causes the grief that inspired this question.
i am building a project to search for a specific driver at Lenovo Website (https://support.lenovo.com). This site changes the search URL while typing, if a suitable product category is found.
This means for example if you search for "ideapad" it uses:
http://pcsupport.lenovo.com/api_v2/de/de/Product/GetProducts?productId=ideapad
if you search for "T540p 20BE" the Url changes to:
http://pcsupport.lenovo.com/de/de/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t540p/20be?linkTrack=Homepage%3ABody_Search+Products&searchType=4&keyWordSearch=T540p%2520Laptop%2520%2528ThinkPad%2529%2520-%2520Type%252020BE
First i tried to use the url above http://pcsupport.lenovo.com/api_v2/de/de/Product/GetProducts?productId=[Searchpattern]. you get back a Json File which has further information to all modeltypes of that devices. Not the response i needed.
What i need is a way to get back all available drivers for some given Modell.
As Response to the search you get a Html Document, which contains all drivers in an embedded html page:
!]
I have tried different approches with selenium which works, but need a usabel way for my application. I tried with HTMLAgilityPack and xpath, but came not across the problem with changing search urls?
How can i get the Version and the Downloadlink ??
Update: Here is some example code. After not being able to get the correct syntax of the get Statemente, i tried to input the searchtext within the inputbox.
Goal: Be able to paste searchtext into the inputbox within the lenovo site, or overcome the changing urls (as mentioned above).
Extract the needed informations from the resulting driverpage
Edit: Just delete the unneeded code part. Can someone give me a hint for a working approach on this. If HtmlWeb is not the best solution, what would you prefer ?
You need to query for the corresponding elements and get the values you need. For example for version you need to query for the version DOM element (with tag, css class or any other attribute) and get the InnerText property. For the download links you need to query for the download element and get the href attribute.
If you have any problems during the development, add the code to the question to let us understand what you are doing and for what you are querying.
Edit: About the url search part. First of all, you need to understand that your HtmlDocument is not a browser and you cannot search products by filling the textbox in the site. You need to find other way to find the corresponding url for the inserted product. One option can be to get data from all available search urls, combine that data, and search inside of that combined one.
I'm trying to do a global search on the website (I'm using Sitecore 8.1) using Lucene and field boosting. The idea is that I want to search in the content that is on the pages, and not all the pages have the same template. So I cannot know what fields I should be searching for to see if those contain the content I'm looking for.
Here I also want to integrate the field boosting, for which I haven't found yet any example.
Does anyone know if the way I'm trying to do it it is a good idea, and point me into some direction?
Whan I'm trying to find out is how I should create my query and how to access the field boosting to sort my results?
You can boost the importance of specific fields.
For example, you may want to boost the value of specific fields, such as title or abstract.Set the boost attribute of the relevant /configuration/sitecore/contentSearch/configuration/DefaultIndexConfiguration/fieldMap/fieldNames/fieldName
element in the Web.config file, typically specified in the /App_Config/Include/Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config
Web.config include file. All indexes share this configuration by default.
And also you can boost field inside content editor on Indexing Section.
Field boosting applies at indexing time
More information you can find here:
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/04/sitecore-7-six-types-of-search-boosting.aspx
After you set the boost value and are indexing your content use Luke to check the rank are your fields. My suggestion is to not use boost on fields because are not really relevant for the end user if the text they are searching is on Title or Abstract field.
I'm having issues with Umbraco when trying to get access to a node by it's url.
I've been trying to form an xpath query to select on the url, but I've no idea how to do that, and everything in their API is a 'dynamic' so I'm finding it impossible to dig much deeper for other methods.
The "Link to document" property in the Umbraco editor shows the path to be "/links/link-regions/link-region-1/". Its location in the editor is "/Data/Links/Link Regions/Link Region 1".
I suspect it'll look like this, but I cna't make it work:
//*[#url='/links/link-regions/link-region-1/']
I basically want to know what I have to do to get the node by providing either of these values and no others. I've been trying to do this for days now to no avail, please help!
If you're using Umbraco 4.11 or later, there are a new set of APIs that allow you to retrieve strongly-typed content (as opposed to dynamic - which can be frustrating when trying to evaluate types when debugging).
UmbracoContext.Current.ContentCache.GetByRoute(string url) should do what you want.
Background
I want to put a lookup field in sharepoint list that will point to a folder. Thats the easy part, but I want user to be pointed to folder contents (not the folder properties) after clicking on the link. It's not possible from the sharepoint interface so I'm trying to create custom field type.
Question
What method should I overload in SPFieldLookup derived class (or anywhere else :P) to be able to point user to folder contents?
P.S. Please don't suggest creating a hyperlink field cause the link will break under different access mappings.
Instead of a custom field, I would consider a computed field (search for "computed" here) and keep your current lookup field. The computed field is simply a UI representation of a column. That is how SharePoint does Title, Title with link, Title with menu, etc. Those aren't multiple columns, just multiple ways to view the same data.
To use this approach you need to be able to build your link from the data available to you. We have done this using custom RESTful web services when the data is not immediately available.