I am having quite the difficulty. on our company site https://temp-quitlogixbase.quitlogix.org I had set up the Smart Search functionality. setting up indexes for each of the sites with in the application
(i.e.
https://colorado.quitlogix.org https://arkansas.quitlogix.orghttps://idaho.quitlogix.org
)
I even made sure to limit each site to the index meant for it. the problem is that the smart search results, either changes for each site, or if I include multipule indexes it gives me all the results for all the indexes, not just for the site I am working with. can some one help as to what I am doing wrong?
From your description, it sounds like you want each site's search to work independently so that - e.g. - Idaho results are not served on the Colorado search results.
To do this, you'll have (and sounds like you do) a SmartSearch index set up for each site with the allowed content in the index limited to the site in question.
What I would look at is the template your using for the search results. It looks very similar on the three sites you've listed, which makes me think that they are the same template. If that is the case and you're using a web part for the search results, you'll need a macro or some other logic to tell the page which index to look at.The template is effectively global, so each time you set the index on the Smart search results web part, it will override the previous value, even if you're switching between sites.
A way to do the switching can be to set the Indexes field to something like the following macro:
{% if (CurrentSite.CodeName == "QuitLogix_Arkansas") { "ArkansasSiteIndex" } else if(CurrentSite.CodeName == "QuitLogix_Colorado") { "ColoradoSiteIndex" } else {"IdahoSiteIndex"} #%}
If you've done all that or are using separate templates, you will not need that. Other options can include using multiple Smart search results web parts with their set the visibility based upon the current site or by having a different template for each sub-domain.
Related
I need to count webpage visits in Bolt CMS to make rating of pages. Something like in StackOverflow:
I have contenttype pages with field visits. I know that I need to add in page template some code, but I don't understand how to increment field visits of my current record. Is it possible via twig?
Or I have to add some custom query in template? But I don't know how to do this.
I will be grateful for any advice.
Ok, there's a quick and potentially incorrect way to do this, within your twig template you can increment and save the visits value:
{% record.setValue('visits', record.visits +1 ) %}
{% app.storage.saveContent(record) %}
This will be fine if you're working on a simple project but it does force a db query in every single pageview of your site (including from bots/automated scripts etc) so it isn't really ideal for a production medium/high traffic site.
If you want to tackle it in a more robust way then using the Google Analytics approach of an Async JS tracker is probably better, or you could even use the Google Analytics API to periodically update your visits based on the pageviews recorded by Google.
there is a little more to this I guess. stack overflow also checks unique people that visited. But for a basic solution I would create an table in the database with a simple int field. and set it to 0. (for every page)
Then create a PHP file where you would get this.
$pagid (Get url)
$result = mysql_query('Select count from counter WHERE pageid=$pagid');
$newcount = $result['count'] + 1;
mysql_query('UPDATE counter SET count=$newcount');
Then simply include this in every page and test if when you refresh the page the counter goes up. (The thing I declared in my code field above is a general rundown of what needs to happen so youll need to tweak it a bit)
When you get this to work you can go and try to add some checker if visitor is unique etc. But that is a problem of its own.
If u are ok with using PHP then add the PHP tag the sessions tag and the sql tag, others may give you an better explanation than I did here.
Also the reason you would need to do this using PHP or other script is becouse twig the 'PHP' templated doesnt allow you to modify the database data. It only allows you to GET it.
Hope some of my explanation(s) made sense and hope this helps you with your problem!
I cannot for the life of me work out how to return home pages within SharePoint Online search.
I have a single site collection with a number of sub sites that have a home page set as the default page, however when I create a query results source in SharePoint Online I cannot retrieve any of the homepages. They seem to be excluded?
Any ideas or thoughts to why they would be excluded?
Ideally, I just want to return all homepages for each sub-site within the site collection.
Many thanks.
You need to make sure that all your home pages are having same content type you are using in your filter. You might also use the name of content type in filter instead of id in your filter.
ContentType:"your content type name"
You also need to make sure all these pages are checked in and published to be picked up in search. If you are sure of all that, then try to reindex the whole site collection frim site settings and recheck after a while, normally it takes a couple of hours for crawl to finish and het your results. However, it sometimes take longer depending on search index load on cloud.
I have a slight problem I have been trying to address for a client I have been working with. We have 4 sets of single pages that are loading content from a database using PHP based upon a get string that is provided. These pages that are generated are optimized well for SEO and have alt tags for images and Content that we need to be able to search using a search feature.
Now i had assumed (An everyone knows what assuming gets you) that these pages by default would be able to be searched by the concrete 5 built in search feature. But it doesn't work. If I search for a word that I know is definitely on one of these pages even multiple times no results are found.
How can I make Concrete5 search these pages. If its no do able by a default or by a plugin, then can someone please offer some advice on how to fix this. This is an important feature and must be completed.
EDIT: See my comment below. I still need some help or direction here as CSE inst much of an option.
EDIT2: It may be viable for me to install a crawler and a custom search engine to address my problems. I was thinking of spider. Any other suggestions on that or other options are much appreciated!
Unfortunately C5 doesn't provide a way to do this -- the only way to tap into the search index is with blocks. And even if you created a phony block just to pass content from the single_page through to the search index, there's no way to say that some content is from one URL while other content is from another URL (which you'd need to do since your single_page controller is handling many different URL's).
I don't know of a way to achieve what you want to do (and it appears that nobody else does either -- http://www.concrete5.org/community/forums/customizing_c5/make-content-in-single-pages-searchable/ ), other than building your own internal search engine.
EDIT: I just did some digging, and thought that perhaps you could manually insert records into the PageSearchIndex table and specify the searchable content and the desired path there -- but this won't work because it relies on one cID (collection id, a.k.a. page id) per entry -- so you'd only be able to insert one record for the top-level single_page path.
I think the simplest solution here would be to create your own searching infrastructure for your single_pages (like some kind of function in the controller that would return an array of page paths and searchable content for each one), then override the search block and perform an additional search of your single_page -- then combine the results on the search results page there. Or just use google site search for your site, which will actually crawl the pages and hence find your various single_page urls: https://www.google.com/cse/
Best of luck.
I have not tested this, but maybe you can put a function getSearchableContent() in the single pages controller like you do for blocks. This would return the string to be searched. Would look something like this:
function getSearchableContent() {
// ... compose searchstring depending on the queried content.
return $searchstring;
}
But I don't know if this works for dynamic content. If not, I'd look into C5's search index core classes and try to extend them for your project.
I would like to know if it is possible to use kentico macros (not necessarily coding a custom one) to access part of the rewritten URL's Path.
Example: http://www.mysite.com/Category/Subcategory/
I would like to get the last part (Subcategory) so that I may then filter content dynamically. The reason I want to use the macro is to simply not have to have 20+ different page templates only so I can have different web part properties.
Assuming you are using Portal templates, and you don't want an 'all items in all subcategories' list on the parent:
Create an Article List web part on the parent page — parent to all the sub-categories.
Set the web part Path to /{0}/{1}/{2}/% (if your path was /Home/Parent/Subcategory for example) or something similar for your environment.
Use the default setting of Inherit for the page template for all subcategory pages.
This will not show anything on the parent page, and the sub-categories will show only the documents under themselves. Note: If you want the subcategory items to have their own views when user digs down to /{0}/{1}/{2}/item, you may need to filter by changing template inheritance, or Document Types on the web part, or something like that if you don't want the whole sub-category list to also show on the item-specific pages.
You can create a custom macro or, you can also use the string operations which are allowed within macros. Please see http://devnet.kentico.com/docs/6_0/devguide/available_macro_methods.htm#string_methods (and you can e.g. use the EndsWith or TrimStrart or something similar).
However, I think the best way would be to create a custom macro which will exactly fit. There might be some combination of macros and macro functions - but I think it is faster just to code a custom one which will cover your need 100%.
Also, you can take a look on the K# if there is something that will fit - http://devnet.kentico.com/docs/6_0/devguide/ksharp_syntax.htm
I would like to build a webpart that is going to display list content coming from different site collections (but the same content type).
I wanted to use the SPSiteDataGuery to create the datasource of a SPGridView for instance, but it appears to be working only within the same site collection. Do you have any idea ?
The best performing solution would be to use the search object model. Look into FullTextSqlQuery. You can filter based on content type easily enough. The downside in using this technique is obviously there is a delay until the content is crawled. The performance over anything else however will be significantly better. Waldek has some great articles on comparing the alternatives.