Sitecore - Multilist with Search field - sitecore

I am on Sitecore v8.2
Using Multilist with Search field, is there a way to filter by multiple templates?
TemplateFilter seems to work with just one Template ID (tried pipe delimited value and that didn't work). I would rather not use Filter=_templatename and Filter=_templateid doesn't work.

That's a bit tricky with Sitecore.
As you wrote, TemplateFilter only works with 1 value and it doesn't care about pipe separated template ids.
But you can achieve what you need with Filter parameter. The syntax is:
Filter=_template:{A87A00B1-E6DB-45AB-8B54-636FEC3B5523}|_template:{DA1684ED-C7A7-4B96-B019-C1E3D5169A6A}

Related

How can I boost a particular field using Sitecore 7.5 and Solr 4.7?

I have a field called "Page Title" that is part of a base template that I called "Base Titles". All of my content pages inherit this base template. I would like to boost the Page Title field in my search results so that if the search term is found in that field it is scored higher than other matches.
I can't figure out how to do this. I found this blog post by John West. However that seems to suggest that in order to boost a field I have to edit a config file?
Is that correct? So there is no way within the Sitecore UI to edit boosting values for a field? It has to be done by a programmer in a config file?
There is no in-built functionality for this. But off the top of my head I guess it's possible to approximate it.
For example. If your content editors have access to the Templates section of the Sitecore tree you could extend the "Template Field" template. Add a numeric field called Boost.
Then on any field in a template they could assign a numeric value
When you write your query you could look up the assigned value from of the associated field in the template and use the Boost method to apply it to the predicate.
Of course there's a bunch of different variations on this approach. This is really just the bare bones.
Sounds like you have the makings of a good marketplace module on your hands.

sitecore custom text field

I'm looking for a custom text field that generates an extra text field when needed. Similar to the way a template adds new text fields.
For storage all values can be saved as one comma separated string (or pipe).
Does anyone know if this exists already? I searched the Sitecore marketplace google but haven't found what I need yet.
edit: If none exists yet I will probably make it myself with this reference: https://sdn.sitecore.net/Articles/API/Creating%20a%20Composite%20Custom%20Field.aspx
Since I do need the labels (which need to be translated) and the name value list field doesn't allow duplicate keys we changed our approach.
this was going to be used to input multiple phone numbers, e-mail addresses etc.
In stead we opted to go with separate templates that would be inserted as child items.

sitecore 7 multi datasource field

I have a treelist field that I want to set the datasource to 3 folders p.e.:
/sitecore/Website/News/
/sitecore/Website/Events/
/sitecore/Website/Articles/
Under the website item there are more "folders".
I've searched and spent few hours trying different approaches but none seemed to work.
Is this possible? Do I need to extend the field?
Thank you in advance
A while back I wrote a blog post about the different ways you can control the Datasource of your multilist and treelist fields (with and without search). The third technique listed for fields with search is what I think you are looking for:
Search in two or more places of the content tree (Fields with Search):
StartSearchLocation={110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}&Filter=_path:110d559fdea542ea9c1c8a5df7e70ef9|_path:3d6658d8a0bf4e75b3e2d050fabcf4e1
For your implementation:
StartSearchLocation={Website.ID}&Filter=_path:[News.ID (guid form; no brackets)]|_path:[Events.ID (guid form; no brackets)]|_path:[Articles.ID (guid form; no brackets)]
Search in two or more places of the content tree (Fields without Search):
If you are using a Multilist field (without search) then I would do the following:
DataSource=/path/to/source/1|/path/to/source/2
For your implementation:
DataSource=/sitecore/website/news|/sitecore/website/events|/sitecore/website/articles
I would also add that the Treelist with Search field has been deprecated in later versions of Sitecore 7, so if that is the field that you are using then I advise changing to the Multilist with Search field. If you are using a standard Treelist field, then Ahmed's answer may be viable as well, depending on your use case.
Let me know if you have any questions. Good luck, and happy coding! :)
You can use IncludeTemplatesForDisplay parameter to filter the items based on templates:
DataSource=/Sitecore/Content/Home&IncludeTemplatesForDisplay=News Folder,News,Event Folder,Event
IncludeTemplatesForDisplay parameter accepts comma separated templates names, you might need to include parent folder templates names too so that it appear in treelist.
Hope this helps

Sitecore - How to search by field in multilist with search?

I've made a field "Multilist with Search" in my solution. The point of this field is to add related articles to an article. I have set a source similar to this:
TemplateFilter={TemplateID}&StartSearchLocation=query:/path/to/list/of/items
I want make a search that finds a certain field value. For example, if I want to find the articleId on the searched article. Is there built-in support for this in Sitecore 7.2?
Is it possible to make a search like articleID:706453?
I guess it's not the most easiest solution you're looking for, but you can extend IDataSource in your code and use the type as value in the Source-textbox for the field you want to use it for. With IDataSource you just return an array of items that will be use for your field. You can query whatever item you want.
See the article from John West on the Sitecore blog: http://www.sitecore.net/nederland/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2013/09/Sitecore-7-Custom-Classes-as-Data-Template-Field-Sources.aspx
Otherwise you can try this:
StartSearchLocation=query:/path/to/list/of/items/*[#articleID = '123']
Note that Sitecore queries can be slow.

Having The Source Field be the Link Provided in Another Sitecore Item

Suppose Item A contains the link Item B would like to use as the source of its Droplist field. How can I achieve this? I have read the Sitecore Query documentation here and here. It appears to me that this is not achievable using Sitecore query, but I could be mistaken. Any help would be appreciated.
No this is not possible. To set the source of a droplist, you can either set the root path to an item which would make the droplist populate the sub-items or you can use Sitecore query to query for specific items based on your query. This is covered in the Data Definition Cookbook (PDF link) under 2.4.2.