Drupal8 partial keyword searching - search

I integrated Drupal 8 autocomplete module in my project. Its working fine. At the end search suggestion liss, there is a link for view all results. When I click on the link, it goes to localhost/sampleapp/search/node?keys=test. I got all the results for the keyword "test". But the problem is when the keyword is tes instead of test, I got no results. For example localhost /sampleapp/search/node?keys=tes

Acquia Search supports Solr N-Gram (partial-word search) text fields for Drupal 8 websites using the Search API module.
In the admin menu, go to Configuration > Search and metadata > Search API.
Identify the search index that you want to modify, and then click it.
Click the Fields tab.
For each field that you want to configure for partial-word searching, click Type, and then click Fulltext NGram.
Click Save.
https://docs.acquia.com/acquia-search/relevant-results/partial/

You can alter the queries provided by default.
A similar action you can look into this as reference:
<?php
// Add alter hook to be able to change suggestions in your own module.
$alter_data = array(
'query' => $query,
'response' => $response,
'incomplete_key' => $incomplete_key,
'search' => $search,
);
drupal_alter('search_api_solr_autocomplete_suggestions', $alter_data, $suggestions);
?>
Hope this help.
Thanks.

Related

Sharepoint search query to only show Site Pages (or a new Wiki library)

I've got a new SharePoint Teams site that I'll be building out as a knowledge repository. We'll be creating articles in the "Site Pages" area, though happy to use a new Wiki Page Library if that makes it easier.
I'm trying to amend the Search Query used in the "All" vertical, so that it shows only results from the Site Pages. To test this, I've created a word document in the documents section and named it "Apples WORD.docx" and a Wiki page called "Apples WIKI". When I search for "Apples", I should only see "Apples WIKI" in my results.
I can't seem to figure out the query required to achieve this.
Thanks in advance.
So I've got this working now.
First I renamed an existing managed property by doing the following.
Go to the Site Settings, then Under the 'Site Collection Administration' go to "Search Schema".
Find an available RefinableStringXX managed property; edit it and give it an Alias. Add a mapping to "ContentTypeID".
Back out to the Site Settings then under 'Web Designer Galleries' click on "Site content types".
Find "Wiki Pages" and click on it to find the Content Type ID (which was 0x010108).
Back out to the Site Settings then under 'Microsoft Search', click on "Configure Search Settings".
Click on Verticals, then double click on the vertical that you want to edit. Click the Edit button at the bottom of the page.
Click on 'Query' and enter the text "ContentTypeID:0x010108*"
Save the vertical.
By editing the "All" vertical, the default 'current site' search from the site's homepage now only shows Wiki Page articles.
Maybe you could try adding the search vertical to the search navigation web part to set up a search page for displaying Site Pages.
Reference:Change settings for the Search Navigation Web Part

Magento Filer the data by attribute before algolia search

Am trying to provide the Algolia search option with filter by attribute value. For example from the attached pic, need to filter the data by city attribute and then Algolia shows results results accordingly to selected attribute
Click Here for image
First you need to add the select box with searchable attribute before search input. I assume you use Algolia's Magento extension.
If it's the case you need to put your select box into either autocomplete.phtml file (if you are using default search box selector) or to your theme's template (if you modified search box selector in Algolia settings in Magento administration).
Then if you want to do it on instant search result page you can use searchFunction to restrict searchable attributes:
var search = instantsearch({
[...],
searchFunction: function(helper) {
var searchableAttribute = $('selectbox-selector').val(); // Using jQuery just for example
helper.setQueryParameter('restrictSearchableAttributes', searchableAttribute);
helper.search();
}
}
Initialization of instantsearch you can find in instantsearch.phtml template.
If you want to update results in autocomplete menu, you will have to set the restrictSearchableAttributes parameter to autocomplete data source. The data sources are defined in commonjs.phtml file. More information of autocomplete data sources you can find in autocomplete.js documentation.
Example of updating product's data source:
options.facets = ['categories.level0'];
options.numericFilters = 'visibility_search=1';
options.restrictSearchableAttributes = $('selectbox-selector').val();

Sub categories shopware5

I am using a custom theme in Shopware, the parent theme is "Bare" theme, when I need to use some data or alter existing data, still I do not understand how I can do this using controllr, plugin or widgets.
Example:- I need to display "sub categories" on my home page main menu.
When I use "{debug}" on my index.tpl I can see all the main categories but the sub categories are not available even though I have created and activated sub categories on my back end.
I checked the configurations settings to make sure if anything is blocking it from showing on front end.
What kind of approach I should use to get this thing done.
What is the solution?
Update index controller?
Any CMS option to enable /disable?
install a plugin?
create a widget?
FYI: This is what I can see on my debug screen on home page (index.tpl)
$sCategory
flag => false
subcategories => Array (0)
childrenCount => 2
7 => Array (23)
id => 7
name => "IVORY & WHITE"
metaKeywords => null
There is a plugin called AdvancedMenu which has to be activated via the Plugin Manager. In the plugin's config you are able to define the nesting level of how deep the category should be shown. This setting set to 2 by default, I guess. After activating the plugin there should be a new variable $sAdvancedMenu available in the Smarty template.
Please have a look: http://en.community.shopware.com/_detail_1602.html?_ga=1.192119343.464766896.1445350898
Another way (without the AdvancedMenu plugin) would be as follows:
There is a Shopware Core class available via Shopware()->Modules()->Categories() that contains a method called sGetWholeCategoryTree($current). This method returns the whole category subtree for any given root category. But in that case you need to create a plugin that is listening to the Enlight_Controller_Front_PostDispatch event or any similar. After assigning the tree to the view you will have access to a hierarchical multidimensional array of categories with their related children.

Search module doesn't work in Orchard CMS 1.6?

I'm using Orchard CMS 1.6.
I have added a Search Widget on the Asidesecond zone.
When I went back to my Website I didn't have any input for searching.
So I have created a Custom form and I added a Search Part to it. Then I added a input field.
I have created another Widget in the AsideSecond Zone which contains my Custom Search Form.
When I went back to my WebSite I tried to enter a word in the input and then I pressed Enter key : nothing happened, no search results displaying.
I have already Check for the indexes and the contents to included in the search.
Besides, the search module doesn't display any button to launch the search. Is it normal ?
Thanks for your answers.
Franck
It's works fine right now. The Widget part was missing in the Search Form Content Type. So, what I still don't understand. Why there isn't any button near the Search Widget ? The Admin Content Search have a button, why the Search Widget doesn't have one ? Any Idea ?

Hide CRM form left hand side navigation item

I have my account entity linked to a custom entity called inspections, I only want these inspections to be created for accounts of a certain type. So when it isn't that type I want the left hand navigation to this entity to be hidden away. I've seen some code that says will hide it away, as long as you have the navID of the item.
I've had a crack at hiding it using what i thought could be the ID but it hasn't worked, so I'm wondering if anyone knows how to get this ID, or if there is another way to do this?
The code I'm using to hide the navigation is below:
var navitem = Xrm.Page.ui.navigation.items.get("nav_ts_inspection");
if (navitem != null)
{
navitem.setVisible(false);
}
Load the form
Press F12 to show IE Developer's Toolbar
From here you can use CTRL+F to search for the display name of the item you'd like to hide. This will give you a link that is generated. The Id of this element is what you need to use to show/hide the link.
As an example, you can see results of searching for 'Sub Accounts' on the Account screen for an installation I am working on at the moment. The Id can be seen and is 'navSubAct'
Changes by traversing DOM and manually hide an area is not officially supported.
Luckily if you are on CRM 2011, you can go to
Settings > Customization Or open the solution.
Select the entity > Forms. Inside the Form editor window, open the Form Properties of the entity.
Go to Display Tab and untick "Show navigation items" checkbox.
Finally do not forget to Publish your changes.
Use the relationshipname to hide folder in navigation like this:
If you have folder with the relationship name: ts_inspection
Use this for ID: navts_inspection
So otherwise the same as above, but lose the extra underscore (_) between nav and ts.
var navitem = Xrm.Page.ui.navigation.items.get("navts_inspection");
If you want to hide particular navigation section from the FORM then remove all the links from that section and publish it. That section will not be visible anymore.
If you want to just remove Navigation Pane from FORM, then go to 'Display' tab of form and mark as 'Do Not Show' and then publish it.

Resources